Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saves pending transaction to account when RPC called via broadcastTransaction #5637

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,127 @@
"type": "Buffer",
"data": "base64:AQEAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL+mduPiBu1dPzCWC8MrW3te5muyl61osDU6ESx12CYKCN9XTEhy4SdG7fmU1/ydWFtk9f6Yc85fEGTY6n+F9QLyCfuFKHVoQm9LSIlHF7ViRQ64W4kyG++0hhTRyCPTrq8yCEw2zOXCIhcMguLev55gvrZdHb5N5d0C1Kcb1F8gQG+O+hFJrIK+V4p5Hid6evKsWADvefI8Ta0w2FU7c6GxA7sfMGCSP9/jQAtDMtfSTX3VBR0ZAjjEoFTum9TIPoffNY8Aio3kerLu+9p1UPCCiQ4bGmUPuMZjWZMITZFEspWgZOPjD8r2k3w7T+cvjtfVNHwgUU7GDpnA1yev4EfrYF/MX4HP/mvFq1QPazX4BrYCaHo8ZUacY9XEavbsNBAAAAKbCv+mnQbvDgSIi9N9uUfltk1MK5aQajnFbABXz3Du9yq+X+3Q3llUsyQJJOlhM6fL3a1oB//ACIbZycyVV06ABHsXowF+qg29w1ImeaDgIyfCBIhhd2DCwAULu95xaBbdLpqBRcrl+oW6g19cdP2tm/csvzjFhlhBOsGWe2nUWx37cyiWSVjgpXYfbYeaVR6ZBSNGz85PjV/MhXSaOo/15H25oIvsp95RgKi0wpyIGRLE9X7IUQU+Ft1pfKhSFfBAH2aIhVel/1HEQ+gtVjAvcM8JdciojBeM6aRoPuFw//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GeI9eRyZPwzwrpRrWYSqrLcSZvN3GGaNTw62hxXS4W+iowcjBjH4IKUxwdWOT8vmh+g/LQCbYPbIFEToCH3RLVHMRssyMpVkFyl+1hzyZSLaq5PfmVGeLjKdk/1diYdKgFdoFwUGKQFK6i27A1YI5rqLmfwFJfKEMJEeXQpyad6U+9QrYzLUhOheeHOp4oFquYc5UzDwExg6ADsqksr/3kxxU+KKbxxF0Me6DQ=="
}
],
"Route chain/broadcastTransaction should call add a pending transaction when broadcasting a transaction": [
{
"value": {
"encrypted": false,
"version": 4,
"id": "0e5126c1-1db9-4053-845c-5f9d4df60d85",
"name": "test",
"spendingKey": "067d54ef1884c9406e3c37b7bc925a008e8597910aee6bc4e17adbbde73ad6a5",
"viewKey": "e306ef45cc64b947905d2e58bc53eea20f9a99cd82def3344780112f69638adb4f6c8447c5b6faa5bef2be399a649a3cccce1e56264d0a92bca71dc60ed2c281",
"incomingViewKey": "bbad4b1f09f058ea15d83c2b6b7e0c1021fd680fc0b23d2de76c2a5487141a00",
"outgoingViewKey": "8499da7a1d70d844bc3b539909519054b6de4bb499e480df5cec7b253968e553",
"publicAddress": "9eda6cae85097c85ed89f92710c55a460c3d7c272285fb4fcbb1cbc37f487660",
"createdAt": {
"sequence": 1,
"hash": {
"type": "Buffer",
"data": "base64:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
}
},
"scanningEnabled": true,
"proofAuthorizingKey": "ff6d64eafc477440adbfa4bf9cce17bcbc22188ede71d16935c1c9688a28bb09"
},
"head": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
}
},
{
"header": {
"sequence": 2,
"previousBlockHash": "4791D7AE9F97DF100EF1558E84772D6A09B43762388283F75C6F20A32A88AA86",
"noteCommitment": {
"type": "Buffer",
"data": "base64:CQtdYaPbREL+UqiStqrKCtELy4LkMsnsGG7oJafYaGE="
},
"transactionCommitment": {
"type": "Buffer",
"data": "base64:J6S6wmI1MZfRarjN21x4b8Hg7I5kB/mn0GtG96CIsCk="
},
"target": "9282972777491357380673661573939192202192629606981189395159182914949423",
"randomness": "0",
"timestamp": 1731449707441,
"graffiti": "0000000000000000000000000000000000000000000000000000000000000000",
"noteSize": 4,
"work": "0"
},
"transactions": [
{
"type": "Buffer",
"data": "base64:AQAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGzKiP////8AAAAAFWYuNlSCAbE9JyCAZnrG5fhFIxx4waZ14MB59ibNByaofwhS/c5NIjs+yIaXMxf96s23mlCmQK2gkJCiz6e83oquZbY83LoQQGX3idT2qRGmxd0wJ0KLxX3XWk8ejxz70za00jXN+wME91WUyYy+es19zRNuI+06kyezgYldADUQ/ayEbTEhgm8sWebAqggFou3BDEwdZOSG7xUge8CPm0SPM2iAmLYeKTDed/ys/bSp+pu2HkDtRXUIeF1obOPvL8cPry66AESzwDJqih6oCqtTRcEM1NGXw1GV/MqPHeLYPEmsJwdhq5HaDPaMNYORfgn101qcqMHZCSP6zlhYzM9iDaGnl45OvW6IuOpX7AjTxaaSnXrbK0YWx8LdXhsTPPzX9kQ2UpkaOCZmxmmXFMWyJ4UX2DBd8qMchtFUc8tgfFboMTRRo3C4KFd3IcDCiqVCruoNZXpTQwLYN/m3FKP4hMdDLeSQ71mxkxKT7mnqjExEa9ZUhDT+22f24e3kCUZYJY/e1S3Qe4Ztisjb5NGh7kuYEr/26BXEkfDpahyoyu0bKHtSXANFsSmaQutIwtP2S5H/edXIv8TYRxndaVUVDE1xylsXOOMfbPAqVBHZ9vScNOyNiElyb24gRmlzaCBub3RlIGVuY3J5cHRpb24gbWluZXIga2V5MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwJdsgoFr7LBMgghsxSR5nk4+l/Mt1BVh4TgbnH1t3lKZEHg4j5lS38EyAieRdpxRPVnTR0gH4R4VU4i460vQeBw=="
}
]
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Xu+V7xu3QOm24G+8W16DzMK6I1HNF5uIl3FAnnpPKLgEUCnV7KOlmcBo5ggbd/BfT1KbSZ+nfx2IYkh6xDQFGJi8RzIpuXj1VtqM/+jAg8g/N9Dlj+WobwTOqnVfQIugIhS1VZaQjHNWe8Ea7NAZgC7RnvWrSVKnc9bTzsznnxS6aPGS9jBsD1tPczd3h6sIy7wzeU/Jc91E65cKgzeixTDqG+JaPPXRZlX+Be9ExMplNYpiqf2TponQCuq28JfMmRBHKh1eNiuvll7qbHRtfT1uKarKgpIUaqrqdnmbNsvzskNwC1H76Ws8aALWhRz8Hlw7s9JqYIQZ81NmlZsZDymrs0HwZ8g8IsEpWjlOB4MIrsAZVKo2WLqMsfbMV/1h41p7/HthJN3JZt04DDP6TopJCVUaS6f3x3WSHOm4AQlx975+RqjmlVXhM53/DbQZs4bsTR2clhR9sGW0XqYkU6R1myDBlD90u1867IQPpT5ouCM/xlemX0D4HxAWYnQ0VtQ6i6+nnHHG894T0d74XCGqi2PwcqcwKvvjiBn6WGSvTIM8MvYkfQQl6FFXsGUiEOYUQ6S4MIMdfNzdusyihssvGEV4DCFGsbjaekRREmSo3O3cVUhQd9+sFW3IMgMGyIHYnz28HFQL1ryNbDUDcR5F43VPA9ZpgRPn/ukT15hDjoemRhMAeA0cbGH7pb8NlrDpn7jdjPW5CahgQKSENFk304xRO1Up4UdB276htyNhoAdLzogzIVJbfG81Hdnfi6HrAoTVwwV8DmdIPKv/J3Qdj9VLRO0PWgVDex0qbPlRwB0SyWC0FaEG4+hA7heSBhs+YMCvwbotlPYGXIvFbWbOSuQPCc65K2o5eDrzeGcAct3Iu5zUqGQMADN460a6sAhIglzBYKD/Z006ajCoTqfYk0LB0gBMM41NHTdhy/bqqMH3hFAy/1Ofd2JSX1RZ7d4gNm2/27V96On5EqH4+K3fkNuFQuCSY6R/gBQ=="
}
],
"Route chain/broadcastTransaction should add pending transaction to account when using broadcastTransaction": [
{
"value": {
"encrypted": false,
"version": 4,
"id": "72359603-a271-4765-b629-8f110c515b34",
"name": "test",
"spendingKey": "b2e9b7dd29842fc63c4487e6079c6146397717b048b39eb8708bc3f1ac27c0e7",
"viewKey": "829a085a75176d77e465531938e0fead529b6cd103848163662d2bfc96a4e349bc4688276ce7ca0c1b3c088c587f1a4075420487b2c167bd834d770db63c2c45",
"incomingViewKey": "5c5c538cc27418f068538b7c95f7f9bc69d3ebeed14b9c3f7186ae74c4bcc407",
"outgoingViewKey": "f6b3365c79348d0fc5e98841491af98a68970dfe40146f8e5b9993b4a460adbd",
"publicAddress": "8c2e32f24d90582c35ca520fdb862b61dfdf8596126c6e398ffe1bd2f87fd415",
"createdAt": {
"sequence": 1,
"hash": {
"type": "Buffer",
"data": "base64:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
}
},
"scanningEnabled": true,
"proofAuthorizingKey": "f21eddc440b0b45718c51ac1ce043a6715b916de173163d51f5f8fe058a8360c"
},
"head": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
}
},
{
"header": {
"sequence": 2,
"previousBlockHash": "4791D7AE9F97DF100EF1558E84772D6A09B43762388283F75C6F20A32A88AA86",
"noteCommitment": {
"type": "Buffer",
"data": "base64:7ylhiOGJRIIHBlrfFqBRHCheqHC1MilGAZjntx8ejHE="
},
"transactionCommitment": {
"type": "Buffer",
"data": "base64:dpqa68JTj8mQEJxbEPYYju5OznC7ktkpcpaXOoJiO0w="
},
"target": "9282972777491357380673661573939192202192629606981189395159182914949423",
"randomness": "0",
"timestamp": 1731450015507,
"graffiti": "0000000000000000000000000000000000000000000000000000000000000000",
"noteSize": 4,
"work": "0"
},
"transactions": [
{
"type": "Buffer",
"data": "base64:AQAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGzKiP////8AAAAAE8DQ9499tF7OeKWDmWmguEBkw3he8+loO+SA/DSivBmyLLk+q4adI8tWiIdWOp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mZ5fdCYffJtrW1t+SGmduoQD49O1CI0ludMVfYpoHv0Sr8fUeR/Y20O5F+l4umG/ygM3mNKFKVC30DZgSj7h5KuPUssbqhvY8WFcLUW+s6FLC+IuDT66mqVPUyqDbElgJFN22c518hOeDgKg3p49M7f8KB8oS2cqoEfCkoiy7kOKGc6jsI9RuPkTH2mlbgHKe/dBSG7cbGmKqQsNGBtbuZqVousrpYNgW6orH+uwKtupdAuCAb8Ln0JLqNKJV0q0z8Ld2Fcd3S0uvRaLd3SeKzNbVZG7s2ZbVa3jV74KOUjt4Xw2T/UHixvww8CqKA9whxTUKtZbydJJNFwYng2b9eJYljwUOb04JlRn5SmJV6Be87KrONnLyhIjZHMBvQmBVUpTRJUo4ttopoJp7zBc6vW0VDMoeRFj1CDIuOlsS2gc/yF+0w00MmxkNx1i4ul10UQlvZR8TTKR/H1N5E4tWhXWbJDWh3IBn+/XrPsKyHRy03461LWK9CTFQQLYoJYprBxHp/sMw1ufI3TL02ho70jdj3M6rPBKJILBVNPrHqKjNa0XVY7qm7qy0VNpfupCodrEoidVXiOO9okCdMNduSP7sdu5ttpZWuG7xIaR4qtlh4VABtROzjUgSMe5jzYA/BITe33xlpVTCvxtS4+iidEDQZzZUWPDQ=="
}
]
}
26 changes: 26 additions & 0 deletions ironfish/src/rpc/routes/chain/broadcastTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
useTxFixture,
} from '../../../testUtilities/fixtures'
import { createRouteTest } from '../../../testUtilities/routeTest'
import { AsyncUtils } from '../../../utils'

describe('Route chain/broadcastTransaction', () => {
const routeTest = createRouteTest()
Expand Down Expand Up @@ -122,4 +123,29 @@ describe('Route chain/broadcastTransaction', () => {
expect(response.content?.accepted).toBe(true)
expect(acceptSpy).toHaveBeenCalled()
})

it('should add pending transaction to account when using broadcastTransaction', async () => {
const { node } = routeTest
jest.spyOn(routeTest.peerNetwork, 'isReady', 'get').mockImplementationOnce(() => true)

const account = await useAccountFixture(node.wallet)
const block2 = await useMinerBlockFixture(node.chain, 2, account)

await node.chain.addBlock(block2)
await node.wallet.scan()

const transaction = await useTxFixture(node.wallet, account, account)
const response = await routeTest.client.chain.broadcastTransaction({
transaction: transaction.serialize().toString('hex'),
})

expect(response.status).toBe(200)

const responseTransactions = routeTest.client.wallet.getAccountTransactionsStream({
account: account.name,
})

const transactions = await AsyncUtils.materialize(responseTransactions.contentStream())
expect(transactions[0].hash).toEqual(transaction.hash().toString('hex'))
})
})
2 changes: 1 addition & 1 deletion ironfish/src/rpc/routes/chain/broadcastTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ routes.register<typeof BroadcastTransactionRequestSchema, BroadcastTransactionRe
context.peerNetwork.broadcastTransaction(transaction)
broadcasted = true
}

await context.wallet.addPendingTransaction(transaction)
request.end({
accepted,
broadcasted,
Expand Down