Skip to content

Commit

Permalink
Use FeeBumpAccount for setting FeeAccountMuxed (#265)
Browse files Browse the repository at this point in the history
* Use FeeBumpAccount for setting FeeAccountMuxed

* dummy commit

* Update tests

---------

Co-authored-by: Simon Chow <[email protected]>
  • Loading branch information
amishas157 and chowbao authored Jul 12, 2024
1 parent 98bea9a commit ab57fa4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
10 changes: 10 additions & 0 deletions internal/transform/test_variables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ var testAccount4Address = "GBVVRXLMNCJQW3IDDXC3X6XCH35B5Q7QXNMMFPENSOGUPQO7WO7HG
var testAccount4ID, _ = xdr.AddressToAccountId(testAccount4Address)
var testAccount4 = testAccount4ID.ToMuxedAccount()

var dummyEd25519 [32]byte
var testAccount5 = xdr.MuxedAccount{
Type: xdr.CryptoKeyTypeKeyTypeMuxedEd25519,
Med25519: &xdr.MuxedAccountMed25519{
Id: xdr.Uint64(1),
Ed25519: xdr.Uint256(dummyEd25519),
},
}
var testAccount5Address = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF"

// a selection of hardcoded assets and their AssetOutput representations

var usdtAsset = xdr.Asset{
Expand Down
4 changes: 2 additions & 2 deletions internal/transform/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ func TransformTransaction(transaction ingest.LedgerTransaction, lhe xdr.LedgerHe
if transaction.Envelope.IsFeeBump() {
feeBumpAccount := transaction.Envelope.FeeBumpAccount()
feeAccount := feeBumpAccount.ToAccountId()
if sourceAccount.Type == xdr.CryptoKeyTypeKeyTypeMuxedEd25519 {
feeAccountMuxed := feeAccount.Address()
if feeBumpAccount.Type == xdr.CryptoKeyTypeKeyTypeMuxedEd25519 {
feeAccountMuxed := feeBumpAccount.Address()
transformedTransaction.FeeAccountMuxed = feeAccountMuxed
}
transformedTransaction.FeeAccount = feeAccount.Address()
Expand Down
7 changes: 4 additions & 3 deletions internal/transform/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func makeTransactionTestOutput() (output []TransactionOutput, err error) {
TransactionResultCode: "TransactionResultCodeTxFailed",
},
{
TxEnvelope: "AAAABQAAAABnzACGTDuJFoxqr+C8NHCe0CHFBXLi+YhhNCIILCIpcgAAAAAAABwgAAAAAgAAAACI4aa0pXFSj6qfJuIObLw/5zyugLRGYwxb7wFSr3B9eAAAAAACFPY2AAAAfQAAAAEAAAAAAAAAAAAAAABfBqt0AAAAAQAAABdITDVhQ2dvelFISVc3c1NjNVhkY2ZtUgAAAAABAAAAAQAAAAAcR0GXGO76pFs4y38vJVAanjnLg4emNun7zAx0pHcDGAAAAAIAAAAAAAAAAAAAAAAAAAAAAQIDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
TxEnvelope: "AAAABQAAAQAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHCAAAAACAAAAAIjhprSlcVKPqp8m4g5svD/nPK6AtEZjDFvvAVKvcH14AAAAAAIU9jYAAAB9AAAAAQAAAAAAAAAAAAAAAF8Gq3QAAAABAAAAF0hMNWFDZ296UUhJVzdzU2M1WGRjZm1SAAAAAAEAAAABAAAAABxHQZcY7vqkWzjLfy8lUBqeOcuDh6Y26fvMDHSkdwMYAAAAAgAAAAAAAAAAAAAAAAAAAAABAgMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
TxResult: "AAAAAAAAASwAAAABqH/vXusmAmnDgPLeRWqtcrWbsxWqrHd4YEVuCdrAuvsAAAAAAAAAZAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
TxMeta: "AAAAAQAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAwAAAAAAAAAFAQIDBAUGBwgJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFVU1NEAAAAAGtY3WxokwttAx3Fu/riPvoew/C7WMK8jZONR8Hfs75zAAAAHgAAAAAAAYagAAAAAAAAA+gAAAAAAAAB9AAAAAAAAAAZAAAAAAAAAAEAAAAAAAAABQECAwQFBgcICQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVVNTRAAAAABrWN1saJMLbQMdxbv64j76HsPwu1jCvI2TjUfB37O+cwAAAB4AAAAAAAGKiAAAAAAAAARMAAAAAAAAAfYAAAAAAAAAGgAAAAAAAAACAAAAAwAAAAAAAAAFAQIDBAUGBwgJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFVU1NEAAAAAGtY3WxokwttAx3Fu/riPvoew/C7WMK8jZONR8Hfs75zAAAAHgAAAAAAAYagAAAAAAAAA+gAAAAAAAAB9AAAAAAAAAAZAAAAAAAAAAEAAAAAAAAABQECAwQFBgcICQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVVNTRAAAAABrWN1saJMLbQMdxbv64j76HsPwu1jCvI2TjUfB37O+cwAAAB4AAAAAAAGKiAAAAAAAAARMAAAAAAAAAfYAAAAAAAAAGgAAAAAAAAAA",
TxFeeMeta: "AAAAAA==",
Expand All @@ -126,7 +126,8 @@ func makeTransactionTestOutput() (output []TransactionOutput, err error) {
TimeBounds: "[0,1594272628)",
Successful: true,
InnerTransactionHash: "a87fef5eeb260269c380f2de456aad72b59bb315aaac777860456e09dac0bafb",
FeeAccount: testAccount3Address,
FeeAccount: testAccount5Address,
FeeAccountMuxed: "MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFNZG",
NewMaxFee: 7200,
ClosedAt: time.Date(2020, time.July, 9, 5, 28, 42, 0, time.UTC),
ResourceFee: 0,
Expand Down Expand Up @@ -251,7 +252,7 @@ func makeTransactionTestInput() (transaction []ingest.LedgerTransaction, history
Type: xdr.EnvelopeTypeEnvelopeTypeTxFeeBump,
FeeBump: &xdr.FeeBumpTransactionEnvelope{
Tx: xdr.FeeBumpTransaction{
FeeSource: testAccount3,
FeeSource: testAccount5,
Fee: 7200,
InnerTx: xdr.FeeBumpTransactionInnerTx{
Type: xdr.EnvelopeTypeEnvelopeTypeTx,
Expand Down

0 comments on commit ab57fa4

Please sign in to comment.