I'm storing pending operations in a data structure similar to the multisig. wallet contract, i.e.
struct PendingState {
uint yetNeeded;
uint ownersDone;
uint index;
}
and my contract pseudo-ish code:
contract c {
mapping(bytes32 => PendingState) m_pending;
bytes32[] m_pendingIndex;
// initialize operation:
var pending = m_pending[_h];
pending.yetNeeded = bla;
pending.ownersDone = bla;
pending.index = m_pendingIndex.length++;
m_pendingIndex[pending.index] = _h;
// remove the current operation when finished
delete m_pendingIndex[m_pending[_h].index];
delete m_pending[_h];
}
However, if there were three (index = 0, 1, 2) pending operations when we completed -and removed- the second one, then we end up m_pendingIndex[0]
and m_pendingIndex[2]
populated and m_pendingIndex[1]
empty. Will this increase the required gas for later operations? Should I shift the objects back until there is no empty spot? I imagine this process will have a cost itself, but it might be preferable in order to prevent DOS attacks.
Thanks for any help,