projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix various spec bugs, can now open channels with real nodes!
[rust-lightning]
/
src
/
chain
/
transaction.rs
diff --git
a/src/chain/transaction.rs
b/src/chain/transaction.rs
index dad3c1271e4f0e5459691d44ddd092b101e6299c..42a4f952e4150550f240c9c59d5d89a9a885c7de 100644
(file)
--- a/
src/chain/transaction.rs
+++ b/
src/chain/transaction.rs
@@
-20,7
+20,9
@@
impl OutPoint {
/// Convert an `OutPoint` to a lightning channel id.
pub fn to_channel_id(&self) -> Uint256 {
/// Convert an `OutPoint` to a lightning channel id.
pub fn to_channel_id(&self) -> Uint256 {
- // TODO: or le?
- self.txid.into_be() ^ Uint256::from_u64(self.index as u64).unwrap()
+ let mut index = [0; 32];
+ index[30] = ((self.index >> 8) & 0xff) as u8;
+ index[31] = ((self.index >> 0) & 0xff) as u8;
+ self.txid.into_le() ^ Sha256dHash::from(&index[..]).into_le()
}
}
}
}