Search code examples
ethereumtruffleconsensys-truffle

the tx doesn't have the correct nonce. account has nonce of: 5 tx has nonce of: 15


Using truffle (3.4.6), metamask (3.9.2) and testrpc (4.0.1), I call a transaction and get "Error: the tx doesn't have the correct nonce. account has nonce of: 5 tx has nonce of: 15". I have cut down the body of my contract method to something trivial and I still get this. Any idea what causes it?

contract MyContract {
  mapping (address => bool) authorized;

  function myMethod (uint element, uint price) whenNotPaused returns (bool) {
     if (!authorized[msg.sender]) throw;
     return true;
  }
}

I call the method like this (using truffle):

  MyContract.deployed().then((instance) => {
      instance.myMethod (id, price, {from: account}).then (...)

Solution

  • In this thread i saw a suggestion of switching networks back and forth and the error self correcting.

    ¯\_(ツ)_/¯