You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Sort actions so covenants that require linked inputs
// are pushed first into the mtx input/output arrays.
// This is a required step otherwise an unlinked
// covenant like NONE, OPEN, or BID could shift the
// output array out of sync with their corresponding inputs.
actions.sort((a,b)=>{
assert(Array.isArray(a));
assert(Array.isArray(b));
assert(a.length);
assert(b.length);
switch(b[0]){
case'REVEAL':
case'REDEEM':
case'UPDATE':
case'RENEW':
case'TRANSFER':
case'FINALIZE':
case'CANCEL':
case'REVOKE':
return1;
default:
return-1;
}
});
This doesn't retain the order of actions provided. To do so, returning 0 for same covenants before the switch should work (but need to be sure it doesn't break other things):
The text was updated successfully, but these errors were encountered:
rithvikvibhu
changed the title
wallet: keep action order when sorting with same covenant types
wallet: keep batch action order when sorting with same covenant types
Aug 8, 2023
The code in
makeBatch
sorts actions to put the linked covenants first:hsd/lib/wallet/wallet.js
Lines 3741 to 3765 in 500d638
This doesn't retain the order of actions provided. To do so, returning 0 for same covenants before the switch should work (but need to be sure it doesn't break other things):
The text was updated successfully, but these errors were encountered: