Changing code to not deal with nonces
This commit is contained in:
parent
db48083dfb
commit
23f8ebc0bb
|
@ -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();
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue