mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-18 21:35:24 +01:00
lnrpc: add previous_outpoints to listchaintxns
This commit is contained in:
parent
61493a5f29
commit
983d917d4a
File diff suppressed because it is too large
Load Diff
@ -686,7 +686,11 @@ message Transaction {
|
||||
|
||||
// A label that was optionally set on transaction broadcast.
|
||||
string label = 10;
|
||||
|
||||
// PreviousOutpoints/Inputs of this transaction.
|
||||
repeated PreviousOutPoint previous_outpoints = 12;
|
||||
}
|
||||
|
||||
message GetTransactionsRequest {
|
||||
/*
|
||||
The height from which to list transactions, inclusive. If this value is
|
||||
@ -1007,6 +1011,15 @@ message OutPoint {
|
||||
uint32 output_index = 3;
|
||||
}
|
||||
|
||||
message PreviousOutPoint {
|
||||
// The outpoint in format txid:n.
|
||||
string outpoint = 1;
|
||||
|
||||
// Denotes if the outpoint is controlled by the internal wallet.
|
||||
// The flag will only detect p2wkh, np2wkh and p2tr inputs as its own.
|
||||
bool is_our_output = 2;
|
||||
}
|
||||
|
||||
message LightningAddress {
|
||||
// The identity pubkey of the Lightning node.
|
||||
string pubkey = 1;
|
||||
|
@ -5879,6 +5879,19 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"lnrpcPreviousOutPoint": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"outpoint": {
|
||||
"type": "string",
|
||||
"description": "The outpoint in format txid:n."
|
||||
},
|
||||
"is_our_output": {
|
||||
"type": "boolean",
|
||||
"description": "Denotes if the outpoint is controlled by the internal wallet.\nThe flag will only detect p2wkh, np2wkh and p2tr inputs as its own."
|
||||
}
|
||||
}
|
||||
},
|
||||
"lnrpcPsbtShim": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -6501,6 +6514,13 @@
|
||||
"label": {
|
||||
"type": "string",
|
||||
"description": "A label that was optionally set on transaction broadcast."
|
||||
},
|
||||
"previous_outpoints": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/lnrpcPreviousOutPoint"
|
||||
},
|
||||
"description": "PreviousOutpoints/Inputs of this transaction."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -45,6 +45,14 @@ func RPCTransaction(tx *lnwallet.TransactionDetail) *Transaction {
|
||||
})
|
||||
}
|
||||
|
||||
previousOutpoints := make([]*PreviousOutPoint, len(tx.PreviousOutpoints))
|
||||
for idx, previousOutPoint := range tx.PreviousOutpoints {
|
||||
previousOutpoints[idx] = &PreviousOutPoint{
|
||||
Outpoint: previousOutPoint.OutPoint,
|
||||
IsOurOutput: previousOutPoint.IsOurOutput,
|
||||
}
|
||||
}
|
||||
|
||||
// We also get unconfirmed transactions, so BlockHash can be nil.
|
||||
blockHash := ""
|
||||
if tx.BlockHash != nil {
|
||||
@ -52,17 +60,18 @@ func RPCTransaction(tx *lnwallet.TransactionDetail) *Transaction {
|
||||
}
|
||||
|
||||
return &Transaction{
|
||||
TxHash: tx.Hash.String(),
|
||||
Amount: int64(tx.Value),
|
||||
NumConfirmations: tx.NumConfirmations,
|
||||
BlockHash: blockHash,
|
||||
BlockHeight: tx.BlockHeight,
|
||||
TimeStamp: tx.Timestamp,
|
||||
TotalFees: tx.TotalFees,
|
||||
DestAddresses: destAddresses,
|
||||
OutputDetails: outputDetails,
|
||||
RawTxHex: hex.EncodeToString(tx.RawTx),
|
||||
Label: tx.Label,
|
||||
TxHash: tx.Hash.String(),
|
||||
Amount: int64(tx.Value),
|
||||
NumConfirmations: tx.NumConfirmations,
|
||||
BlockHash: blockHash,
|
||||
BlockHeight: tx.BlockHeight,
|
||||
TimeStamp: tx.Timestamp,
|
||||
TotalFees: tx.TotalFees,
|
||||
DestAddresses: destAddresses,
|
||||
OutputDetails: outputDetails,
|
||||
RawTxHex: hex.EncodeToString(tx.RawTx),
|
||||
Label: tx.Label,
|
||||
PreviousOutpoints: previousOutpoints,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -769,6 +769,19 @@
|
||||
],
|
||||
"default": "SCRIPT_TYPE_PUBKEY_HASH"
|
||||
},
|
||||
"lnrpcPreviousOutPoint": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"outpoint": {
|
||||
"type": "string",
|
||||
"description": "The outpoint in format txid:n."
|
||||
},
|
||||
"is_our_output": {
|
||||
"type": "boolean",
|
||||
"description": "Denotes if the outpoint is controlled by the internal wallet.\nThe flag will only detect p2wkh, np2wkh and p2tr inputs as its own."
|
||||
}
|
||||
}
|
||||
},
|
||||
"lnrpcTransaction": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -826,6 +839,13 @@
|
||||
"label": {
|
||||
"type": "string",
|
||||
"description": "A label that was optionally set on transaction broadcast."
|
||||
},
|
||||
"previous_outpoints": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/lnrpcPreviousOutPoint"
|
||||
},
|
||||
"description": "PreviousOutpoints/Inputs of this transaction."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user