mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-08-23 17:47:29 +00:00
Set account name for gettransaction results.
This only sets the name for any kind of "receiving" category (receive/immature/generate). Fixes #360.
This commit is contained in:
parent
32ca19322a
commit
102cd553c5
1 changed files with 13 additions and 4 deletions
|
@ -911,19 +911,28 @@ func GetTransaction(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var addr string
|
var address string
|
||||||
|
var accountName string
|
||||||
_, addrs, _, err := txscript.ExtractPkScriptAddrs(
|
_, addrs, _, err := txscript.ExtractPkScriptAddrs(
|
||||||
details.MsgTx.TxOut[cred.Index].PkScript, w.ChainParams())
|
details.MsgTx.TxOut[cred.Index].PkScript, w.ChainParams())
|
||||||
if err == nil && len(addrs) == 1 {
|
if err == nil && len(addrs) == 1 {
|
||||||
addr = addrs[0].EncodeAddress()
|
addr := addrs[0]
|
||||||
|
address = addr.EncodeAddress()
|
||||||
|
account, err := w.Manager.AddrAccount(addr)
|
||||||
|
if err == nil {
|
||||||
|
accountName, err = w.Manager.AccountName(account)
|
||||||
|
if err != nil {
|
||||||
|
accountName = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.Details = append(ret.Details, btcjson.GetTransactionDetailsResult{
|
ret.Details = append(ret.Details, btcjson.GetTransactionDetailsResult{
|
||||||
// Fields left zeroed:
|
// Fields left zeroed:
|
||||||
// InvolvesWatchOnly
|
// InvolvesWatchOnly
|
||||||
// Account
|
|
||||||
// Fee
|
// Fee
|
||||||
Address: addr,
|
Account: accountName,
|
||||||
|
Address: address,
|
||||||
Category: credCat,
|
Category: credCat,
|
||||||
Amount: cred.Amount.ToBTC(),
|
Amount: cred.Amount.ToBTC(),
|
||||||
Vout: cred.Index,
|
Vout: cred.Index,
|
||||||
|
|
Loading…
Add table
Reference in a new issue