I wrote what I thought was a dead simple contract - a saving jar... you add value ("save") into the jar and when the balance of the contract reaches a certain amount ("target"), then I am able to withdraw the value. But whenever I try to send it value, it errors with "Bad Jump Destination"
Here is my contract:
pragma solidity ^0.4.0;
contract jar {
uint public target;
uint public numDonations;
function jar (uint _target) {
target = _target;
numDonations = 0;
}
function save() {
numDonations++;
}
function getBalance() constant returns (uint) {
return this.balance;
}
function withdraw () {
if (this.balance < target) throw;
if (!msg.sender.send(this.balance)) throw;
}
}
And here is the save command I am sending:
jar.save({from:eth.accounts[0], value: 100000000000000000, gas:3000000})
Here is an example of a failed transaction:
https://testnet.etherscan.io/tx/0xcf93aa967f6d1d42b84147511ab58a66a468ee8a102a8d78f78f071ec1a30a05
I have never seen this error before and I am totally stumped. Any pointers would be greatly appreciated.