walletrpc: extract leases marshall function
This commit is contained in:
parent
37331a5ab2
commit
b8e54fffbf
@ -1078,6 +1078,17 @@ func (w *WalletKit) FundPsbt(_ context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert the lock leases to the RPC format.
|
// Convert the lock leases to the RPC format.
|
||||||
|
rpcLocks := marshallLeases(locks)
|
||||||
|
|
||||||
|
return &FundPsbtResponse{
|
||||||
|
FundedPsbt: rawPsbt.Bytes(),
|
||||||
|
ChangeOutputIndex: changeIndex,
|
||||||
|
LockedUtxos: rpcLocks,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// marshallLeases converts the lock leases to the RPC format.
|
||||||
|
func marshallLeases(locks []*wtxmgr.LockedOutput) []*UtxoLease {
|
||||||
rpcLocks := make([]*UtxoLease, len(locks))
|
rpcLocks := make([]*UtxoLease, len(locks))
|
||||||
for idx, lock := range locks {
|
for idx, lock := range locks {
|
||||||
rpcLocks[idx] = &UtxoLease{
|
rpcLocks[idx] = &UtxoLease{
|
||||||
@ -1091,11 +1102,7 @@ func (w *WalletKit) FundPsbt(_ context.Context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &FundPsbtResponse{
|
return rpcLocks
|
||||||
FundedPsbt: rawPsbt.Bytes(),
|
|
||||||
ChangeOutputIndex: changeIndex,
|
|
||||||
LockedUtxos: rpcLocks,
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FinalizePsbt expects a partial transaction with all inputs and outputs fully
|
// FinalizePsbt expects a partial transaction with all inputs and outputs fully
|
||||||
|
Loading…
Reference in New Issue
Block a user