diff --git a/src/abieos.cpp b/src/abieos.cpp index 037667b..f3ab403 100644 --- a/src/abieos.cpp +++ b/src/abieos.cpp @@ -111,7 +111,9 @@ extern "C" abieos_bool abieos_set_abi(abieos_context* context, uint64_t contract return set_error(context, std::move(error)); abieos::abi c; convert(def, c); - context->contracts.insert({name{contract}, std::move(c)}); + const name key {contract}; + context->contracts.erase(key); + context->contracts.insert({key, std::move(c)}); return true; }); } @@ -132,7 +134,9 @@ extern "C" abieos_bool abieos_set_abi_bin(abieos_context* context, uint64_t cont from_bin(def, stream); abieos::abi c; convert(def, c); - context->contracts.insert({name{contract}, std::move(c)}); + const name key {contract}; + context->contracts.erase(key); + context->contracts.insert({key, std::move(c)}); return true; }); }