lnwallet: payment and revocation hashes are now 32 bytes

This unifies some inconstancies across the code-base with hashes being
32 vs 20 bytes. All hashes, whether payment or revocation are now
uniformly 32 bytes everywhere. As a result, only OP_SHA256 will be used
within commitment and HTLC scripts. The rationale for using sha256
instead of hash160 for the HTLC payment pre-image is that alternative
chains are more likely to have sha256 implemented, rather than
ripemd160.

A forthcoming commit will update the current commitment, and HTLC
scripts.
This commit is contained in:
Olaoluwa Osuntokun committed 2016-06-26 23:04:14 -07:00
1 parent 1a48db3039
commit 05fb9b5a6d
3 files changed
+11 -11

No files matched your search

+3 -3
View File
@@ -97,7 +97,7 @@ type bobNode struct {
// For simplicity, used for both the commit tx and the multi-sig output.
channelKey *btcec.PublicKey
deliveryAddress btcutil.Address
revocation [20]byte
revocation [32]byte
delay uint32
id [wire.HashSize]byte
@@ -228,7 +228,7 @@ func newBobNode(miner *rpctest.Harness, amt btcutil.Amount) (*bobNode, error) {
// Bob's initial revocation hash is just his private key with the first
// byte changed...
var revocation [20]byte
var revocation [32]byte
copy(revocation[:], bobsPrivKey)
revocation[0] = 0xff
@@ -488,7 +488,7 @@ func testDualFundingReservationWorkflow(miner *rpctest.Harness, lnwallet *Lightn
// Obtain bob's signature for the closure transaction.
redeemScript := lnc.channelState.FundingRedeemScript
fundingOut := lnc.ChannelPoint()
fundingTxIn := wire.NewTxIn(&fundingOut, nil, nil)
fundingTxIn := wire.NewTxIn(fundingOut, nil, nil)
bobCloseTx := createCooperativeCloseTx(fundingTxIn,
lnc.channelState.TheirBalance, lnc.channelState.OurBalance,
lnc.channelState.TheirDeliveryScript, lnc.channelState.OurDeliveryScript,