mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
walletrpc: don't assert() when we pay ourselves.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
0d3eaef945
commit
6d0fd84c63
@@ -2427,6 +2427,13 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
c.execute('SELECT COUNT(*) FROM outputs WHERE status=0')
|
c.execute('SELECT COUNT(*) FROM outputs WHERE status=0')
|
||||||
assert(c.fetchone()[0] == 6)
|
assert(c.fetchone()[0] == 6)
|
||||||
|
|
||||||
|
# Test withdrawal to self.
|
||||||
|
out = l1.rpc.withdraw(l1.rpc.newaddr()['address'], 'all')
|
||||||
|
bitcoind.rpc.generate(1)
|
||||||
|
c = db.cursor()
|
||||||
|
c.execute('SELECT COUNT(*) FROM outputs WHERE status=0')
|
||||||
|
assert(c.fetchone()[0] == 1)
|
||||||
|
|
||||||
out = l1.rpc.withdraw(waddr, 'all')
|
out = l1.rpc.withdraw(waddr, 'all')
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
c.execute('SELECT COUNT(*) FROM outputs WHERE status=0')
|
c.execute('SELECT COUNT(*) FROM outputs WHERE status=0')
|
||||||
|
|||||||
@@ -58,7 +58,9 @@ static void wallet_withdrawal_broadcast(struct bitcoind *bitcoind,
|
|||||||
tx = bitcoin_tx_from_hex(withdraw, withdraw->hextx, strlen(withdraw->hextx));
|
tx = bitcoin_tx_from_hex(withdraw, withdraw->hextx, strlen(withdraw->hextx));
|
||||||
assert(tx != NULL);
|
assert(tx != NULL);
|
||||||
wallet_extract_owned_outputs(ld->wallet, tx, &change_satoshi);
|
wallet_extract_owned_outputs(ld->wallet, tx, &change_satoshi);
|
||||||
assert(change_satoshi == withdraw->changesatoshi);
|
|
||||||
|
/* Note normally, change_satoshi == withdraw->changesatoshi, but
|
||||||
|
* not if we're actually making a payment to ourselves! */
|
||||||
|
|
||||||
struct json_result *response = new_json_result(cmd);
|
struct json_result *response = new_json_result(cmd);
|
||||||
json_object_start(response, NULL);
|
json_object_start(response, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user