channel: unwrap and send incoming HTLCs to master.

So far it just looks it up, marks it resolved, then does nothing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-04-01 21:28:30 +10:30
parent 8a84e961ed
commit be4af38d0c
7 changed files with 211 additions and 8 deletions

View File

@@ -38,7 +38,7 @@ FUND_INPUT_TX=`$CLI getrawtransaction $FUND_INPUT_TXID`
lcli1 addfunds $FUND_INPUT_TX | $FGREP '"satoshis" : 10000002'
# Now fund a channel.
lcli1 fundchannel $ID2 100000
lcli1 fundchannel $ID2 1000000
# Now wait for it to reach depth
lcli1 getpeers info | $FGREP "Waiting for our funding tx"
@@ -53,9 +53,22 @@ check "lcli2 getpeers | tr -s '\012\011\" ' ' ' | $FGREP 'condition : Normal ope
SECRET=1de08917a61cb2b62ed5937d38577f6a7bfe59c176781c6d8128018e8b5ccdfd
RHASH=`lcli1 dev-rhash $SECRET | sed 's/.*"\([0-9a-f]*\)".*/\1/'`
# This is actually dust
lcli1 dev-newhtlc $ID2 100000 $(( $(blockheight) + 10 )) $RHASH
check "lcli1 getlog debug | $FGREP 'Sending commit_sig with 0 htlc sigs'"
check "lcli2 getlog debug | $FGREP 'their htlc 0 locked'"
check "lcli2 getpeers info | $FGREP 'failed htlc 0 code 0x400f'"
# This one isn't dust.
RHASH=`lcli2 invoice 100000000 testpayment1 | get_field rhash`
[ `lcli2 listinvoice testpayment1 | get_field complete` = false ]
lcli1 dev-newhtlc $ID2 100000000 $(( $(blockheight) + 10 )) $RHASH
check "lcli1 getlog debug | $FGREP 'Sending commit_sig with 1 htlc sigs'"
check "lcli2 getlog debug | $FGREP 'Resolving invoice '\'testpayment1\'' with HTLC 1'"
[ `lcli2 listinvoice testpayment1 | get_field complete` = true ]
lcli1 stop
lcli2 stop