I have a mapping linking a key and a byte32
, and I would like to extend it to store something as long as a byte64.
I chose to cut it in half, but what is the best (and lightest) way to store the two parts ? Should I map to a struct like this:
struct b64 {
bytes32 part1;
bytes32 part2;
}
mapping (uint256 => b64) public b64s;
Or use two mappings, like this:
mapping (uint256 => bytes32) public b64s_1;
mapping (uint256 => bytes32) public b64s_2;
I'm looking for the lightest solution. The only function making the mapping always writes both parts at the same time so I don't think there will be consistency issues with two mappings.
The first solution is cleaner but if I can save precious gas at every writing with the second one I'll take it.