This switches the hashing algorithm used to compute payment hashes from the initial blake256 (the default chainhash.Hash algo) back to the original sha256 for bitcoin.
The main goal for this is to allow cross-chain payments across the btc/dcr/ltc LNs
IMPORTANT: this is a breaking change to our lightning network. Payments across channels made between nodes running v0.1 and v0.2 will NOT work and will cause an automatic forced channel closure.
Given our network is still small and hasn't been run on mainnet yet, I believe it's acceptable to not worry about migration and cross version compatibility and just ask everyone to upgrade. Once enough nodes upgrade to v0.2, the older v0.1 nodes won't be able to participate in the larger network.
The main detail in switching algos is that the LN scripts used for HTLCs had to be changed in our version. The original HTLC scripts use OP_HASH160 to encode the payment hashes which is implemented in bitcoin as ripemd160(sha256(preimage)) and in decred as ripemd160(blake256(preimage)).
In this PR I've unrolled the original opcode into OP_SHA256 OP_HASH160 so that the same payment hash can be sent across coins and redeemed with the exact same preimage.
Note that lnd//dcrlnd does not currently support routing payments across coin boundaries: this is merely a pre-requisite work to enabling that.
This switches the hashing algorithm used to compute payment hashes from the initial blake256 (the default chainhash.Hash algo) back to the original sha256 for bitcoin.
The main goal for this is to allow cross-chain payments across the btc/dcr/ltc LNs
IMPORTANT: this is a breaking change to our lightning network. Payments across channels made between nodes running v0.1 and v0.2 will NOT work and will cause an automatic forced channel closure.
Given our network is still small and hasn't been run on mainnet yet, I believe it's acceptable to not worry about migration and cross version compatibility and just ask everyone to upgrade. Once enough nodes upgrade to v0.2, the older v0.1 nodes won't be able to participate in the larger network.
The main detail in switching algos is that the LN scripts used for HTLCs had to be changed in our version. The original HTLC scripts use
OP_HASH160
to encode the payment hashes which is implemented in bitcoin asripemd160(sha256(preimage))
and in decred asripemd160(blake256(preimage))
.In this PR I've unrolled the original opcode into
OP_SHA256 OP_HASH160
so that the same payment hash can be sent across coins and redeemed with the exact same preimage.Note that lnd//dcrlnd does not currently support routing payments across coin boundaries: this is merely a pre-requisite work to enabling that.