added fee_mask support

factoredcoreloader
Paul Shapiro 5 years ago
parent 304f41d1a7
commit a22f259558

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -81,6 +81,7 @@ struct Send_Task_AsyncContext
//
vector<SpendableOutput> unspent_outs;
uint64_t fee_per_b;
uint64_t fee_mask;
//
// cached
secret_key sec_viewKey;
@ -286,6 +287,7 @@ void emscr_async_bridge::send_funds(const string &args_string)
//
unspent_outs, // this gets pushed to after getting unspent outs
0, // fee_per_b - this gets set after getting unspent outs
0, // fee_mask - this gets set after getting unspent outs
//
// cached
sec_viewKey,
@ -381,6 +383,7 @@ void emscr_async_bridge::send_cb_I__got_unspent_outs(const string &args_string)
THROW_WALLET_EXCEPTION_IF(ptrTo_taskAsyncContext->unspent_outs.size() != 0, error::wallet_internal_error, "Expected 0 ptrTo_taskAsyncContext->unspent_outs in cb I");
ptrTo_taskAsyncContext->unspent_outs = std::move(*(parsed_res.unspent_outs)); // move structs from stack's vector to heap's vector
ptrTo_taskAsyncContext->fee_per_b = *(parsed_res.per_byte_fee);
ptrTo_taskAsyncContext->fee_mask = *(parsed_res.fee_mask);
_reenterable_construct_and_send_tx(task_id);
}
void emscr_async_bridge::_reenterable_construct_and_send_tx(const string &task_id)
@ -405,6 +408,7 @@ void emscr_async_bridge::_reenterable_construct_and_send_tx(const string &task_i
},
ptrTo_taskAsyncContext->unspent_outs,
ptrTo_taskAsyncContext->fee_per_b,
ptrTo_taskAsyncContext->fee_mask,
//
ptrTo_taskAsyncContext->passedIn_attemptAt_fee // use this for passing step2 "must-reconstruct" return values back in, i.e. re-entry; when none, defaults to attempt at network min
// ^- and this will be 'none' as initial value
@ -494,6 +498,7 @@ void emscr_async_bridge::send_cb_II__got_random_outs(const string &args_string)
ptrTo_taskAsyncContext->simple_priority,
ptrTo_taskAsyncContext->step1_retVals__using_outs,
ptrTo_taskAsyncContext->fee_per_b,
ptrTo_taskAsyncContext->fee_mask,
*(parsed_res.mix_outs),
[] (uint8_t version, int64_t early_blocks) -> bool
{

@ -1 +1 @@
Subproject commit 888098e8611aea298ca53c2a00109b6795f7d631
Subproject commit 365f4a1a5c01e2e3c371b5ee27784b724818894f

@ -138,7 +138,8 @@ class Fetch
]
} // NOTE: we'd have more in the real reply - and even the api response parser doesn't care about those values right now
],
per_byte_fee: "24658"
per_byte_fee: "24658",
fee_mask: "10000"
/*deprecated*/// per_kb_fee: parseInt("24658"/*for str search*/) * 1024 // scale the per b we know up to per kib (so it can be scaled back down - interrim until all clients are ready for per b fee)
})
} else if (url.indexOf("get_random_outs") !== -1) {
@ -251,7 +252,7 @@ describe("sendingFunds tests", function()
success_fn: function(params)
{
assert.equal(params.mixin, 10);
assert.equal(params.total_sent, "266009466")
assert.equal(params.total_sent, "266010000")
assert.equal(params.final_payment_id, "d2f602b240fbe624")
console.log("Sendfunds success")
console.log("sentAmount", params.total_sent)

Loading…
Cancel
Save