channeldb: remove premature buf.Grow optimization
This optimization isn't needed as a bytes.Buffer already comes pre-allocated with 64-bytes as a fast path.
This commit is contained in:
parent
3f2aa1c368
commit
71d7d4952f
@ -536,7 +536,6 @@ func updateChanBucket(tx *bolt.Tx, nodeKey *btcec.PublicKey,
|
|||||||
// level, creating the bucket (if it doesn't exist), for this channel
|
// level, creating the bucket (if it doesn't exist), for this channel
|
||||||
// itself.
|
// itself.
|
||||||
var chanPointBuf bytes.Buffer
|
var chanPointBuf bytes.Buffer
|
||||||
chanPointBuf.Grow(outPointSize)
|
|
||||||
if err := writeOutpoint(&chanPointBuf, outPoint); err != nil {
|
if err := writeOutpoint(&chanPointBuf, outPoint); err != nil {
|
||||||
return nil, fmt.Errorf("unable to write outpoint: %v", err)
|
return nil, fmt.Errorf("unable to write outpoint: %v", err)
|
||||||
}
|
}
|
||||||
@ -582,7 +581,6 @@ func readChanBucket(tx *bolt.Tx, nodeKey *btcec.PublicKey,
|
|||||||
// With the bucket for the node fetched, we can now go down another
|
// With the bucket for the node fetched, we can now go down another
|
||||||
// level, for this channel itself.
|
// level, for this channel itself.
|
||||||
var chanPointBuf bytes.Buffer
|
var chanPointBuf bytes.Buffer
|
||||||
chanPointBuf.Grow(outPointSize)
|
|
||||||
if err := writeOutpoint(&chanPointBuf, outPoint); err != nil {
|
if err := writeOutpoint(&chanPointBuf, outPoint); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -625,7 +623,6 @@ func (c *OpenChannel) fullSync(tx *bolt.Tx) error {
|
|||||||
// level, creating the bucket (if it doesn't exist), for this channel
|
// level, creating the bucket (if it doesn't exist), for this channel
|
||||||
// itself.
|
// itself.
|
||||||
var chanPointBuf bytes.Buffer
|
var chanPointBuf bytes.Buffer
|
||||||
chanPointBuf.Grow(outPointSize)
|
|
||||||
if err := writeOutpoint(&chanPointBuf, &c.FundingOutpoint); err != nil {
|
if err := writeOutpoint(&chanPointBuf, &c.FundingOutpoint); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1765,7 +1762,6 @@ func (c *OpenChannel) CloseChannel(summary *ChannelCloseSummary) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var chanPointBuf bytes.Buffer
|
var chanPointBuf bytes.Buffer
|
||||||
chanPointBuf.Grow(outPointSize)
|
|
||||||
err := writeOutpoint(&chanPointBuf, &c.FundingOutpoint)
|
err := writeOutpoint(&chanPointBuf, &c.FundingOutpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user