multi: populate both string and byte TXID in lnrpc.Outpoint

This commit adds a a new `MarshalOutPoint` helper in the `lnrpc` package
that can be used to convert a `wire.Outpoint` to an `lnrpc.Outpoint`.
By using this helper, we are less likely to forget to populate both the
string and byte form of the TXID.
This commit is contained in:
Elle Mouton committed 2023-04-24 16:19:26 +02:00
1 parent 4355ce62d2
commit 7b186716a1
6 files changed
+22 -25

No files matched your search

+3 -10
View File
@@ -756,10 +756,7 @@ func (w *WalletKit) PendingSweeps(ctx context.Context,
pendingInput.OutPoint)
}
op := &lnrpc.OutPoint{
TxidBytes: pendingInput.OutPoint.Hash[:],
OutputIndex: pendingInput.OutPoint.Index,
}
op := lnrpc.MarshalOutPoint(&pendingInput.OutPoint)
amountSat := uint32(pendingInput.Amount)
satPerVbyte := uint64(pendingInput.LastFeeRate.FeePerKVByte() / 1000)
broadcastAttempts := uint32(pendingInput.BroadcastAttempts)
@@ -1241,12 +1238,8 @@ func marshallLeases(locks []*base.ListLeasedOutputResult) []*UtxoLease {
lock := lock
rpcLocks[idx] = &UtxoLease{
Id: lock.LockID[:],
Outpoint: &lnrpc.OutPoint{
TxidBytes: lock.Outpoint.Hash[:],
TxidStr: lock.Outpoint.Hash.String(),
OutputIndex: lock.Outpoint.Index,
},
Id: lock.LockID[:],
Outpoint: lnrpc.MarshalOutPoint(&lock.Outpoint),
Expiration: uint64(lock.Expiration.Unix()),
PkScript: lock.PkScript,
Value: uint64(lock.Value),