File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change 11// Copyright 2015-2017 Parity Technologies (UK) Ltd.
2+ // Copyright 2019 Kodebox, Inc.
23// This file is part of Parity.
34
45// Parity is free software: you can redistribute it and/or modify
@@ -23,7 +24,6 @@ use hashdb::*;
2324use kvdb:: { DBTransaction , KeyValueDB } ;
2425use primitives:: { Bytes , H256 } ;
2526use rlp:: { decode, encode} ;
26- use std:: collections:: hash_map:: Entry ;
2727use std:: collections:: HashMap ;
2828use std:: sync:: Arc ;
2929
@@ -72,14 +72,9 @@ impl HashDB for ArchiveDB {
7272 self . backing . iter ( self . column ) . map ( |( key, _) | ( H256 :: from_slice ( & * key) , 1 ) ) . collect ( ) ;
7373
7474 for ( key, refs) in self . overlay . keys ( ) {
75- match ret. entry ( key) {
76- Entry :: Occupied ( mut entry) => {
77- * entry. get_mut ( ) += refs;
78- }
79- Entry :: Vacant ( entry) => {
80- entry. insert ( refs) ;
81- }
82- }
75+ let rc = ret. entry ( key) . or_default ( ) ;
76+ * rc += refs;
77+ assert ! ( * rc >= -1 , "rc should be equal to or greater than -1, but {}" , rc) ;
8378 }
8479 ret
8580 }
You can’t perform that action at this time.
0 commit comments