Skip to content

Commit

Permalink
Add affected public keys for coin lockups (#1235)
Browse files Browse the repository at this point in the history
  • Loading branch information
lazynina authored Apr 17, 2024
1 parent 3e6a225 commit 7a08720
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions lib/legacy_mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down

0 comments on commit 7a08720

Please sign in to comment.