multi: make NewChanIDFromOutpoint accept value instead of pointer
This commit is contained in:
1 parent
fd1cd315ce
commit
db39a905cb
27 files changed
+108
-106
No files matched your search
@@ -40,7 +40,7 @@ func (c ChannelID) String() string {
|
||||
// usable within the network. In order to convert the OutPoint into a ChannelID,
|
||||
// we XOR the lower 2-bytes of the txid within the OutPoint with the big-endian
|
||||
// serialization of the Index of the OutPoint, truncated to 2-bytes.
|
||||
func NewChanIDFromOutPoint(op *wire.OutPoint) ChannelID {
|
||||
func NewChanIDFromOutPoint(op wire.OutPoint) ChannelID {
|
||||
// First we'll copy the txid of the outpoint into our channel ID slice.
|
||||
var cid ChannelID
|
||||
copy(cid[:], op.Hash[:])
|
||||
@@ -85,7 +85,7 @@ func (c *ChannelID) GenPossibleOutPoints() [MaxFundingTxOutputs]wire.OutPoint {
|
||||
// IsChanPoint returns true if the OutPoint passed corresponds to the target
|
||||
// ChannelID.
|
||||
func (c ChannelID) IsChanPoint(op *wire.OutPoint) bool {
|
||||
candidateCid := NewChanIDFromOutPoint(op)
|
||||
candidateCid := NewChanIDFromOutPoint(*op)
|
||||
|
||||
return candidateCid == c
|
||||
}
|
||||
@@ -17,7 +17,7 @@ func TestChannelIDOutPointConversion(t *testing.T) {
|
||||
|
||||
// With the output index mutated, we'll convert it into a
|
||||
// ChannelID.
|
||||
cid := NewChanIDFromOutPoint(&testChanPoint)
|
||||
cid := NewChanIDFromOutPoint(testChanPoint)
|
||||
|
||||
// Once the channel point has been converted to a channelID, it
|
||||
// should recognize its original outpoint.
|
||||
@@ -48,7 +48,7 @@ func TestGenPossibleOutPoints(t *testing.T) {
|
||||
// We'll first convert out test outpoint into a ChannelID.
|
||||
testChanPoint := *outpoint1
|
||||
testChanPoint.Index = 24
|
||||
chanID := NewChanIDFromOutPoint(&testChanPoint)
|
||||
chanID := NewChanIDFromOutPoint(testChanPoint)
|
||||
|
||||
// With the chan ID created, we'll generate all possible root outpoints
|
||||
// given this channel ID.
|
||||
|
||||
Reference in new issue
Block a user