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
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 { message Utxo {
/// The type of address /// The type of address
AddressType type = 1 [json_name = "address_type"]; AddressType type = 1 [json_name = "address_type"];
/// The address /// The address
string address = 2 [json_name = "address"]; string address = 2 [json_name = "address"];
/// The value of the unspent coin in satoshis /// The value of the unspent coin in satoshis
int64 amount_sat = 3 [json_name = "amount_sat"]; int64 amount_sat = 3 [json_name = "amount_sat"];
/// The scriptpubkey in hex /// The scriptpubkey in hex
string script_pubkey = 4 [json_name = "script_pubkey"]; string script_pubkey = 4 [json_name = "script_pubkey"];
/// The outpoint in format txid:n /// The outpoint in format txid:n
/// Note that this reuses the `ChannelPoint` message but OutPoint outpoint = 5 [json_name = "outpoint"];
/// is not actually a channel related outpoint, of course
ChannelPoint outpoint = 5 [json_name = "outpoint"];
/// The number of confirmations for the Utxo /// The number of confirmations for the Utxo
int64 confirmations = 6 [json_name = "confirmations"]; int64 confirmations = 6 [json_name = "confirmations"];
} }
message Transaction { message Transaction {
@@ -800,6 +798,17 @@ message ChannelPoint {
uint32 output_index = 3 [json_name = "output_index"]; 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 { message LightningAddress {
/// The identity pubkey of the Lightning node /// The identity pubkey of the Lightning node
string pubkey = 1 [json_name = "pubkey"]; 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": { "lnrpcPayReq": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -3014,8 +3033,8 @@
"title": "/ The scriptpubkey in hex" "title": "/ The scriptpubkey in hex"
}, },
"outpoint": { "outpoint": {
"$ref": "#/definitions/lnrpcChannelPoint", "$ref": "#/definitions/lnrpcOutPoint",
"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" "title": "/ The outpoint in format txid:n"
}, },
"confirmations": { "confirmations": {
"type": "string", "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, // Now that we know we have a proper mapping to an address,
// we'll convert the regular outpoint to an lnrpc variant. // we'll convert the regular outpoint to an lnrpc variant.
outpoint := &lnrpc.ChannelPoint{ outpoint := &lnrpc.OutPoint{
FundingTxid: &lnrpc.ChannelPoint_FundingTxidStr{ TxidBytes: utxo.OutPoint.Hash[:],
FundingTxidStr: utxo.OutPoint.Hash.String(), TxidStr: utxo.OutPoint.Hash.String(),
},
OutputIndex: utxo.OutPoint.Index, OutputIndex: utxo.OutPoint.Index,
} }