Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix: set networkId on forked raw transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmurdoch committed Apr 18, 2020
1 parent 25de0e2 commit 6249df1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/statemanager.js
Expand Up @@ -310,7 +310,7 @@ StateManager.prototype.queueRawTransaction = function(data, callback) {
"mainnet", // TODO needs to match chain id
{
name: "ganache",
networkId: this.options.network_id || this.forkVersion,
networkId: this.options.network_id || this.blockchain.forkVersion,
chainId,
comment: "Local test network",
bootstrapNodes: []
Expand Down
17 changes: 17 additions & 0 deletions test/forking.js
@@ -1,3 +1,4 @@
const Transaction = require("../lib/utils/transaction");
var Web3 = require("web3");
var Web3WsProvider = require("web3-providers-ws");
var assert = require("assert");
Expand Down Expand Up @@ -510,6 +511,22 @@ describe("Forking", function() {
assert.strictEqual(code, "0x");
});

it("should be able to send a signed transaction", async() => {
const transaction = new Transaction({
value: "0x10000000",
gasLimit: "0x33450",
from: mainAccounts[8],
to: mainAccounts[7],
nonce: "0x0"
});

const secretKey = mainWeb3.currentProvider.manager.state.accounts[mainAccounts[8].toLowerCase()].secretKey;
transaction.sign(secretKey);

const result = await mainWeb3.eth.sendSignedTransaction(transaction.serialize());
assert.strictEqual(result.status, true);
});

describe("Can debug a transaction", function() {
let send;
before("generate send", function() {
Expand Down

0 comments on commit 6249df1

Please sign in to comment.