From 5dc9cd16f954b09fcae0a37f326825f311b6d82e Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 1 Jul 2015 13:26:23 +0930 Subject: [PATCH] create-steal-tx: actually output the steal tx, not the commit tx! ... Which reveals it wasn't paying a fee. So update fix that, and initialize the alpha tx fields while we're there. Signed-off-by: Rusty Russell --- test-cli/create-steal-tx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test-cli/create-steal-tx.c b/test-cli/create-steal-tx.c index 394733a82..275395dc8 100644 --- a/test-cli/create-steal-tx.c +++ b/test-cli/create-steal-tx.c @@ -103,8 +103,11 @@ int main(int argc, char *argv[]) tx = bitcoin_tx(ctx, 1, 1); bitcoin_txid(commit, &tx->input[0].txid); tx->input[0].index = i; + tx->input[0].input_amount = commit->output[i].amount; - tx->output[0].amount = commit->output[i].amount; + /* Leave 10,000 satoshi as fee. */ + tx->fee = 10000; + tx->output[0].amount = commit->output[i].amount - tx->fee; tx->output[0].script = scriptpubkey_p2sh(tx, bitcoin_redeem_single(tx, &outpubkey)); tx->output[0].script_length = tal_count(tx->output[0].script); @@ -120,7 +123,7 @@ int main(int argc, char *argv[]) tx->input[0].script_length = tal_count(tx->input[0].script); /* Print it out in hex. */ - tx_arr = linearize_tx(ctx, commit); + tx_arr = linearize_tx(ctx, tx); tx_hex = tal_arr(tx_arr, char, hex_str_size(tal_count(tx_arr))); hex_encode(tx_arr, tal_count(tx_arr), tx_hex, tal_count(tx_hex));