open-channel: fix revocation hash.

Revocation hash is SHA256 of output of generator.  Sometimes
that is the same as the next revocation hash (on even counts), but
not otherwise.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2015-06-05 13:15:56 +09:30
parent 6c62e20701
commit ca18eeeaa7

View file

@ -181,9 +181,11 @@ int main(int argc, char *argv[])
&changekey); &changekey);
anchor.change->amount = total_in - (anchor.total + anchor.fee); anchor.change->amount = total_in - (anchor.total + anchor.fee);
} }
/* Get first revocation hash. */ /* Get first revocation hash. */
shachain_from_seed(&seed, 0, &revocation_hash); shachain_from_seed(&seed, 0, &revocation_hash);
sha256(&revocation_hash,
revocation_hash.u.u8, sizeof(revocation_hash.u.u8));
pkt = openchannel_pkt(ctx, weak_random64(), &revocation_hash, &outkey, pkt = openchannel_pkt(ctx, weak_random64(), &revocation_hash, &outkey,
commit_tx_fee, locktime_seconds, &anchor); commit_tx_fee, locktime_seconds, &anchor);