Steem Powr Rent Bug Fix: Update Previous Existing Current Delegation Status to "Premature"
The SP Lease when status is "premature" means that the current delegation has not expired and yet a payment is received.
Previously, dealing this is tricky - and the code was buggy - I manually updated the status to "premature". Let's say if I forgot to do this what would happen?
- a payment is received for the delegation to person A for 7 days.
- delegation of amount X is given to A.
- another payment is sent for the new delegation to person A for 100 days.
- delegation of amount Y is given to A. (Y overrides the amount X)
- however, after day 7 - the delegation of first record (X amount) will be revoked meaning person A will be delegated none.
- day 100, the undelegation will fail because there is no delegation at that moment.
This can be fixed by updating the delegation records at the point of current delegate action is being performed e.g. steem.broadcast.delegateVestingShares. So basically, this:
function updatePrematureLeases(currentRecord) {
return new Promise((resolve, reject) => {
const sql = "update `rentsp` set `result`='premature' where `id` < ? and `sender_block` < ? and `ts` < ? and `delegatee` = ? and `result`='leasing' limit 1";
const values = [
currentRecord.id, currentRecord.sender_block, currentRecord.ts, currentRecord.delegatee
];
db.connection.query(sql, values).on('result', function (row) {
resolve(true);
}).on('error', function (err) {
resolve(false);
});
});
}
Steem to the Moon🚀!
- You can rent Steem Power via rentsp!
- You can swap the TRON:TRX/USDT/USDD to STEEM via tron2steem!
- You can swap the STEEM/SBD to SOL Solana via steem2sol!
- You can swap the STEEM/SBD to ETH Ethereum via steem2eth!
- You can swap the STEEM/SBD to Tether USDT (TRC-20) via steem2usdt!
- You can swap the STEEM/SBD to TRX (TRON) via steem2trx!
- You can swap the STEEM/SBD to BTS (BitShares) via steem2bts!
- Register a free STEEM account at SteemYY!
- Steem Block Explorer
- ChatGPT/Steem Integration: You can type !ask command to invoke ChatGPT
- Steem Witness Table and API
- Other Steem Tools