From 517eff024761ae4e7b40b6dd7d0f48a7bee4e393 Mon Sep 17 00:00:00 2001 From: Lazy Nina Date: Tue, 16 Apr 2024 16:43:34 -0400 Subject: [PATCH] Add affected public keys for coin lockups --- lib/legacy_mempool.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/legacy_mempool.go b/lib/legacy_mempool.go index dbadae617..9eae0fd63 100644 --- a/lib/legacy_mempool.go +++ b/lib/legacy_mempool.go @@ -2034,6 +2034,42 @@ func ComputeTransactionMetadata( txindexMetadata, affectedPublicKeys := utxoView.CreateUnjailValidatorTxindexMetadata(utxoOps[len(utxoOps)-1], txn) txnMeta.UnjailValidatorTxindexMetadata = txindexMetadata txnMeta.AffectedPublicKeys = append(txnMeta.AffectedPublicKeys, affectedPublicKeys...) + case TxnTypeCoinLockup: + realTxMeta := txn.TxnMeta.(*CoinLockupMetadata) + profilePublicKey := realTxMeta.ProfilePublicKey.ToBytes() + recipientPublicKey := realTxMeta.RecipientPublicKey.ToBytes() + txnMeta.AffectedPublicKeys = append(txnMeta.AffectedPublicKeys, &AffectedPublicKey{ + PublicKeyBase58Check: PkToString(profilePublicKey, utxoView.Params), + Metadata: "CoinLockupProfilePublicKeyBase58Check", + }) + txnMeta.AffectedPublicKeys = append(txnMeta.AffectedPublicKeys, &AffectedPublicKey{ + PublicKeyBase58Check: PkToString(recipientPublicKey, utxoView.Params), + Metadata: "CoinLockupRecipientPublicKeyBase58Check", + }) + case TxnTypeUpdateCoinLockupParams: + txnMeta.AffectedPublicKeys = append(txnMeta.AffectedPublicKeys, &AffectedPublicKey{ + PublicKeyBase58Check: PkToString(txn.PublicKey, utxoView.Params), + Metadata: "UpdateCoinLockupParamsPublicKeyBase58Check", + }) + case TxnTypeCoinLockupTransfer: + realTxMeta := txn.TxnMeta.(*CoinLockupTransferMetadata) + profilePublicKey := realTxMeta.ProfilePublicKey.ToBytes() + recipientPublicKey := realTxMeta.RecipientPublicKey.ToBytes() + txnMeta.AffectedPublicKeys = append(txnMeta.AffectedPublicKeys, &AffectedPublicKey{ + PublicKeyBase58Check: PkToString(profilePublicKey, utxoView.Params), + Metadata: "CoinLockupTransferProfilePublicKeyBase58Check", + }) + txnMeta.AffectedPublicKeys = append(txnMeta.AffectedPublicKeys, &AffectedPublicKey{ + PublicKeyBase58Check: PkToString(recipientPublicKey, utxoView.Params), + Metadata: "CoinLockupTransferRecipientPublicKeyBase58Check", + }) + case TxnTypeCoinUnlock: + realTxMeta := txn.TxnMeta.(*CoinUnlockMetadata) + profilePublicKey := realTxMeta.ProfilePublicKey.ToBytes() + txnMeta.AffectedPublicKeys = append(txnMeta.AffectedPublicKeys, &AffectedPublicKey{ + PublicKeyBase58Check: PkToString(profilePublicKey, utxoView.Params), + Metadata: "CoinUnlockProfilePublicKeyBase58Check", + }) case TxnTypeAtomicTxnsWrapper: realTxMeta := txn.TxnMeta.(*AtomicTxnsWrapperMetadata) txnMeta.AtomicTxnsWrapperTxindexMetadata = &AtomicTxnsWrapperTxindexMetadata{}