lnrpc+rpcserver: replace ChanPoint w/ OutPoint in Utxo msg

This commit is contained in:
Conner Fromknecht 2019-02-01 18:01:51 -08:00
parent ddfcba46e7
commit c74dcbe6ff
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7
4 changed files with 652 additions and 568 deletions

File diff suppressed because it is too large Load Diff

View File

@ -669,25 +669,23 @@ service Lightning {
}
message Utxo {
/// The type of address
AddressType type = 1 [json_name = "address_type"];
/// The type of address
AddressType type = 1 [json_name = "address_type"];
/// The address
string address = 2 [json_name = "address"];
/// The address
string address = 2 [json_name = "address"];
/// The value of the unspent coin in satoshis
int64 amount_sat = 3 [json_name = "amount_sat"];
/// The value of the unspent coin in satoshis
int64 amount_sat = 3 [json_name = "amount_sat"];
/// The scriptpubkey in hex
string script_pubkey = 4 [json_name = "script_pubkey"];
/// The scriptpubkey in hex
string script_pubkey = 4 [json_name = "script_pubkey"];
/// The outpoint in format txid:n
/// Note that this reuses the `ChannelPoint` message but
/// is not actually a channel related outpoint, of course
ChannelPoint outpoint = 5 [json_name = "outpoint"];
/// The outpoint in format txid:n
OutPoint outpoint = 5 [json_name = "outpoint"];
/// The number of confirmations for the Utxo
int64 confirmations = 6 [json_name = "confirmations"];
/// The number of confirmations for the Utxo
int64 confirmations = 6 [json_name = "confirmations"];
}
message Transaction {
@ -800,6 +798,17 @@ message ChannelPoint {
uint32 output_index = 3 [json_name = "output_index"];
}
message OutPoint {
/// Raw bytes representing the transaction id.
bytes txid_bytes = 1 [json_name = "txid_bytes"];
/// Reversed, hex-encoded string representing the transaction id.
string txid_str = 2 [json_name = "txid_str"];
/// The index of the output on the transaction.
uint32 output_index = 3 [json_name = "output_index"];
}
message LightningAddress {
/// The identity pubkey of the Lightning node
string pubkey = 1 [json_name = "pubkey"];

View File

@ -2435,6 +2435,25 @@
}
}
},
"lnrpcOutPoint": {
"type": "object",
"properties": {
"txid_bytes": {
"type": "string",
"format": "byte",
"description": "/ Raw bytes representing the transaction id."
},
"txid_str": {
"type": "string",
"description": "/ Reversed, hex-encoded string representing the transaction id."
},
"output_index": {
"type": "integer",
"format": "int64",
"description": "/ The index of the output on the transaction."
}
}
},
"lnrpcPayReq": {
"type": "object",
"properties": {
@ -3014,8 +3033,8 @@
"title": "/ The scriptpubkey in hex"
},
"outpoint": {
"$ref": "#/definitions/lnrpcChannelPoint",
"title": "/ The outpoint in format txid:n\n/ Note that this reuses the `ChannelPoint` message but\n/ is not actually a channel related outpoint, of course"
"$ref": "#/definitions/lnrpcOutPoint",
"title": "/ The outpoint in format txid:n"
},
"confirmations": {
"type": "string",

View File

@ -717,10 +717,9 @@ func (r *rpcServer) ListUnspent(ctx context.Context,
// Now that we know we have a proper mapping to an address,
// we'll convert the regular outpoint to an lnrpc variant.
outpoint := &lnrpc.ChannelPoint{
FundingTxid: &lnrpc.ChannelPoint_FundingTxidStr{
FundingTxidStr: utxo.OutPoint.Hash.String(),
},
outpoint := &lnrpc.OutPoint{
TxidBytes: utxo.OutPoint.Hash[:],
TxidStr: utxo.OutPoint.Hash.String(),
OutputIndex: utxo.OutPoint.Index,
}