mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 05:14:14 +00:00
wire txpool to json rpc
This commit is contained in:
parent
b3570fae6a
commit
1404f45a88
@ -234,7 +234,6 @@ proc setupEthRpc*(node: EthereumNode, ctx: EthContext, chain: BaseChainDB, txPoo
|
|||||||
## obj: the transaction object.
|
## obj: the transaction object.
|
||||||
## Returns the transaction hash, or the zero hash if the transaction is not yet available.
|
## Returns the transaction hash, or the zero hash if the transaction is not yet available.
|
||||||
## Note: Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.
|
## Note: Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.
|
||||||
# TODO: Relies on pending pool implementation
|
|
||||||
let
|
let
|
||||||
address = data.source.toAddress
|
address = data.source.toAddress
|
||||||
acc = ctx.am.getAccount(address).tryGet()
|
acc = ctx.am.getAccount(address).tryGet()
|
||||||
@ -248,6 +247,10 @@ proc setupEthRpc*(node: EthereumNode, ctx: EthContext, chain: BaseChainDB, txPoo
|
|||||||
eip155 = chain.currentBlock >= chain.config.eip155Block
|
eip155 = chain.currentBlock >= chain.config.eip155Block
|
||||||
signedTx = signTransaction(tx, acc.privateKey, chain.config.chainId, eip155)
|
signedTx = signTransaction(tx, acc.privateKey, chain.config.chainId, eip155)
|
||||||
rlpTx = rlp.encode(signedTx)
|
rlpTx = rlp.encode(signedTx)
|
||||||
|
res = txPool.addLocal(signedTx, force = true)
|
||||||
|
|
||||||
|
if res.isErr:
|
||||||
|
raise newException(ValueError, $res.error)
|
||||||
|
|
||||||
result = keccak_256.digest(rlpTx).ethHashStr
|
result = keccak_256.digest(rlpTx).ethHashStr
|
||||||
|
|
||||||
@ -257,9 +260,15 @@ proc setupEthRpc*(node: EthereumNode, ctx: EthContext, chain: BaseChainDB, txPoo
|
|||||||
## data: the signed transaction data.
|
## data: the signed transaction data.
|
||||||
## Returns the transaction hash, or the zero hash if the transaction is not yet available.
|
## Returns the transaction hash, or the zero hash if the transaction is not yet available.
|
||||||
## Note: Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.
|
## Note: Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.
|
||||||
# TODO: Relies on pending pool implementation
|
let
|
||||||
let rlpBytes = hexToSeqByte(data.string)
|
txBytes = hexToSeqByte(data.string)
|
||||||
result = keccak_256.digest(rlpBytes).ethHashStr
|
signedTx = rlp.decode(txBytes, Transaction)
|
||||||
|
res = txPool.addLocal(signedTx, force = true)
|
||||||
|
|
||||||
|
if res.isErr:
|
||||||
|
raise newException(ValueError, $res.error)
|
||||||
|
|
||||||
|
result = keccak_256.digest(txBytes).ethHashStr
|
||||||
|
|
||||||
server.rpc("eth_call") do(call: EthCall, quantityTag: string) -> HexDataStr:
|
server.rpc("eth_call") do(call: EthCall, quantityTag: string) -> HexDataStr:
|
||||||
## Executes a new message call immediately without creating a transaction on the block chain.
|
## Executes a new message call immediately without creating a transaction on the block chain.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user