Bc

mamamoeswe(2)
Published in
#no
Words
102
Reading
1 min
Listen
Play
8y

In src/rpc/blockchain.cpp:

  •        "]\n"
    
  •    );
    
  • RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VOBJ});
  • UniValue result(UniValue::VOBJ);
  • if (request.params[0].get_str() == "status") {
  •    CoinsViewScanReserver reserver;
    
  •    if (reserver.reserve()) {
    
  •        throw JSONRPCError(RPC_INVALID_PARAMETER, "No scan in progress");
    
  •    }
    
  •    result.pushKV("progress", g_scan_progress);
    
  • } else if (request.params[0].get_str() == "abort") {
  •    CoinsViewScanReserver reserver;
    
  •    if (reserver.reserve()) {
    
  •        return false;
    

Since this return value is subject to several races [1], I believe you could just return NullUniValue;

[1]:

e.g. the scan finishes between the last call and this one
e.g. this call returns true, but the last start call was not (yet) actually aborted

Bc | Ecency