Auto label utxos based on invoice and payjoin (#1499)

* Auto label utxos based on invoice and payjoin

This PR introduces automatic labelling to transactions.
* If it is an incoming tx to an invoice, it will tag it as such.
* If it was a payjoin tx , it will tag it as such.
* If a transaction's inputs were exposed to a payjoin sender, we tag it as such.

* wip

* wip

* support in coinselection

* remove ugly hack

* support wallet transactions page

* remove messy loop

* better label template helpers

* add tests and susbcribe to event

* simplify data

* fix test

* fix label  + color

* fix remove label

* renove useless call

* add toString

* fix potential crash by txid

* trim json keyword in manual label

* format file
This commit is contained in:
Andrew Camilleri
2020-04-28 08:06:28 +02:00
committed by GitHub
parent 3801eeec43
commit b31fb1a269
16 changed files with 254 additions and 49 deletions

View File

@@ -143,7 +143,7 @@ namespace BTCPayServer.Controllers
var walletTransactionsInfo = await walletTransactionsInfoAsync;
if (addlabel != null)
{
addlabel = addlabel.Trim().ToLowerInvariant().Replace(',',' ').Truncate(MaxLabelSize);
addlabel = addlabel.Trim().TrimStart('{').ToLowerInvariant().Replace(',',' ').Truncate(MaxLabelSize);
var labels = walletBlobInfo.GetLabels();
if (!walletTransactionsInfo.TryGetValue(transactionId, out var walletTransactionInfo))
{
@@ -170,7 +170,7 @@ namespace BTCPayServer.Controllers
}
else if (removelabel != null)
{
removelabel = removelabel.Trim().ToLowerInvariant().Truncate(MaxLabelSize);
removelabel = removelabel.Trim();
if (walletTransactionsInfo.TryGetValue(transactionId, out var walletTransactionInfo))
{
if (walletTransactionInfo.Labels.Remove(removelabel))