Skip to content

Commit

Permalink
Merge #414 #416
Browse files Browse the repository at this point in the history
414: fix: clear tx verfy cache when chain reorg r=doitian a=zhangsoledad



416: chore: ensure cfbc version r=zhangsoledad a=doitian



Co-authored-by: zhangsoledad <787953403@qq.com>
Co-authored-by: ian <ian@nervos.org>
  • Loading branch information
3 people committed Apr 9, 2019
3 parents 2f3914e + 3da3e83 + 2a1b8ef commit 32be9aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Makefile
Expand Up @@ -68,15 +68,18 @@ gen: ${GEN_FILES}
gen-clean:
rm -f ${GEN_FILES}

check-cfbc-version:
test "$$($(CFBC) --version)" = 0.1.9

%_generated.rs: %.fbs
$(FLATC) -r -o $(shell dirname $@) $<

%_generated_verifier.rs: %.fbs
%_generated_verifier.rs: %.fbs check-cfbc-version
$(FLATC) -b --schema -o $(shell dirname $@) $<
$(CFBC) -o $(shell dirname $@) $*.bfbs
rm -f $*.bfbs $*_builder.rs

.PHONY: build prod prod-test docker gen gen-clean
.PHONY: build prod prod-test docker gen gen-clean check-cfbc-version
.PHONY: fmt test clippy doc doc-deps check stats
.PHONY: ci info security-audit
.PHONY: integration integration-release
4 changes: 4 additions & 0 deletions shared/src/chain_state.rs
Expand Up @@ -263,6 +263,10 @@ impl<CI: ChainIndex> ChainState<CI> {
attached.extend(blk.commit_transactions().iter().skip(1).cloned())
}

if !detached.is_empty() {
self.txs_verify_cache.borrow_mut().clear();
}

let retain: Vec<&Transaction> = detached.difference(&attached).collect();

for tx in retain {
Expand Down

0 comments on commit 32be9aa

Please sign in to comment.