I'm getting a strange error in Solidity. I have the following public function:
struct Bid {
address bidder;
uint amount; /* in wei */
bool home; /* true=home, false=away */
int64 line;
}
event BidPlaced(bytes32 indexed game_id, BookType book, address bidder, uint amount, bool home, int64 line);
function test(bytes32 game_id, bool home, int64 line) payable returns (int) {
Game game = getGameById(game_id);
Book book = game.books[uint(BookType.Spread)];
Bid memory bid = Bid(msg.sender, msg.value, home, line);
// problem is right here
book.homeBids.push(bid);
BidPlaced(game_id, BookType.Spread, msg.sender, msg.value, home, line);
return 0;
}
When I call the function with contract.test.call(...)
, it returns 0, but when I run contract.test.sendTransaction(...)
, the BidPlaced event doesn't log.
When I check the receipt for how much gas is being used, it shows the expected amount, so I know an error isn't being thrown.
If I get rid of the book.homeBids.push(bid);
line, the event logs properly. What about that line could cause a problem?