Changing code to not deal with nonces

This commit is contained in:
Richard Ramos 2018-10-10 20:17:32 -04:00
parent db48083dfb
commit 23f8ebc0bb
2 changed files with 6 additions and 9 deletions

View File

@ -103,8 +103,6 @@ class MessageProcessor {
const gasPrice = toBN(await this.web3.eth.getGasPrice()).add(toBN(this.config.gasPrice.modifier)).toString();
const nonce = await this.web3.eth.getTransactionCount(this.config.node.blockchain.account.address);
if(!validationResult.estimatedGas){
validationResult.estimatedGas = await this.web3.eth.estimateGas(p);
}
@ -116,12 +114,10 @@ class MessageProcessor {
to: input.contract,
value: "0x00",
data: input.payload,
nonce: toHex(nonce),
gasPrice: toHex(parseInt(gasPrice, 10)),
gasLimit: toHex(estimatedGas) // Tune this,
gasPrice: parseInt(gasPrice, 10),
gas: estimatedGas + 1000 // Tune this,
};
const nodeBalance = await this.web3.eth.getBalance(this.config.node.blockchain.account.address);
if(nodeBalance < p.gas){
@ -130,9 +126,7 @@ class MessageProcessor {
this.events.emit('exit');
} else {
try {
const signedTrx = await account.signTransaction(p);
this.web3.eth.sendSignedTransaction(signedTrx.rawTransaction)
this.web3.eth.sendTransaction(p)
.on('transactionHash', function(hash){
reply("Transaction broadcasted: " + hash);
cb();

View File

@ -45,6 +45,9 @@ events.on('web3:connected', connURL => {
account = accountParser.get(config.node.blockchain, web3);
web3.eth.accounts.wallet.add(account);
if(!account) {
process.exit(1);
} else {