Move short_channel_id primitive into bitcoin

Not really a bitcoin primitive but the place where we keep all the
small stuff currently.
This commit is contained in:
Christian Decker
2017-07-20 20:49:45 +02:00
committed by Rusty Russell
parent 5912c68185
commit fa6e53bb08
7 changed files with 65 additions and 42 deletions

View File

@@ -477,25 +477,6 @@ static bool get_slash_u32(const char **arg, u32 *v)
return (endp == *arg);
}
bool short_channel_id_from_str(const char *str, size_t strlen,
struct short_channel_id *dst)
{
u32 blocknum, txnum;
u16 outnum;
int matches;
char buf[strlen + 1];
memcpy(buf, str, strlen);
buf[strlen] = 0;
matches = sscanf(buf, "%u:%u:%hu", &blocknum, &txnum, &outnum);
dst->blocknum = blocknum;
dst->txnum = txnum;
dst->outnum = outnum;
return matches == 3;
}
/* srcid/dstid/base/var/delay/minblocks */
char *opt_add_route(const char *arg, struct lightningd_state *dstate)
{

View File

@@ -177,10 +177,4 @@ struct route_hop *get_route(tal_t *ctx, struct routing_state *rstate,
* the direction bit the matching channel should get */
#define get_channel_direction(from, to) (pubkey_cmp(from, to) > 0)
bool short_channel_id_from_str(const char *str, size_t strlen,
struct short_channel_id *dst);
bool short_channel_id_eq(const struct short_channel_id *a,
const struct short_channel_id *b);
#endif /* LIGHTNING_DAEMON_ROUTING_H */