walletrpc: add list sweeps to rpc and cli

This commit is contained in:
carla
2020-05-05 21:34:38 +02:00
parent 99a45e968a
commit f3212057dd
6 changed files with 481 additions and 97 deletions

View File

@ -4568,36 +4568,7 @@ func (r *rpcServer) GetTransactions(ctx context.Context,
return nil, err
}
txDetails := &lnrpc.TransactionDetails{
Transactions: make([]*lnrpc.Transaction, len(transactions)),
}
for i, tx := range transactions {
var destAddresses []string
for _, destAddress := range tx.DestAddresses {
destAddresses = append(destAddresses, destAddress.EncodeAddress())
}
// We also get unconfirmed transactions, so BlockHash can be
// nil.
blockHash := ""
if tx.BlockHash != nil {
blockHash = tx.BlockHash.String()
}
txDetails.Transactions[i] = &lnrpc.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,
RawTxHex: hex.EncodeToString(tx.RawTx),
}
}
return txDetails, nil
return lnrpc.RPCTransactionDetails(transactions), nil
}
// DescribeGraph returns a description of the latest graph state from the PoV