https://cirrus-ci.com/task/5603470202896384?logs=ci#L2681
{
            int64_t nOrderPosOff = 0;
            for (const int64_t& nOffsetStart  nOrderPosOffsets)
            {
                if (nOrderPos >= nOffsetStart)
                    ++nOrderPosOff;
            }
            nOrderPos += nOrderPosOff;
            nOrderPosNext = stdmax(nOrderPosNext, nOrderPos + 1);
            if (!nOrderPosOff)
                continue;
            // S
            if (!batch.WriteTx(*pwtx))
                return DBErrorsLOAD_FAIL;
        }
    }
    batch.WriteOrderPosNext(nOrderPosNext);
    return DBErrorsLOAD_OK;
}
int64_t CWalletIncOrderPosNext(WalletBatch* batch)
{
    AssertLockHeld(cs_);
    int64_t nRet = nOrderPosNext++;
    if (batch) {
        batch->WriteOrderPosNext(nOrderPosNext);
    } else {
        WalletBatch(GetDatabase()).WriteOrderPosNext(nOrderPosNext);
    }
    return nRet;
}