Skip to content

Problem: validating create+transfer might crash the system#2487

Merged
kansi merged 1 commit intobigchaindb:masterfrom
vrde:fix-validation-error
Aug 29, 2018
Merged

Problem: validating create+transfer might crash the system#2487
kansi merged 1 commit intobigchaindb:masterfrom
vrde:fix-validation-error

Conversation

@vrde
Copy link
Copy Markdown
Contributor

@vrde vrde commented Aug 28, 2018

Solution: if a TRANSFER transaction is validated after a CREATE
transaction, the system crashes with AttributeError: 'NoneType' object has no attribute 'txid'.

This happens because querying get_spent checks the attributes txid
and output of input.fulfills for every transaction in the current
buffer (current_transactions). For a CREATE, input.fulfills is None,
so the check would fail.

The solution is to check if input.fulfills is defined. If not, then
the current transaction cannot spend any output, so we can safely skip
it.

@vrde vrde requested a review from kansi August 28, 2018 16:08
Solution: if a TRANSFER transaction is validated after a CREATE
transaction, the system crashes with `AttributeError: 'NoneType' object
has no attribute 'txid'`.

This happens because querying `get_spent` checks the attributes `txid`
and `output` of `input.fulfills` for every transaction in the current
buffer (`current_transactions`). For a CREATE, `input.fulfills` is None,
so the check would fail.

The solution is to check if `input.fulfills` is defined. If not, then
the current transaction cannot spend any output, so we can safely skip
it.
@vrde vrde force-pushed the fix-validation-error branch from 14a8cb3 to c1840d5 Compare August 28, 2018 19:24
@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #2487 into master will not change coverage.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master    #2487   +/-   ##
=======================================
  Coverage   91.08%   91.08%           
=======================================
  Files          41       41           
  Lines        2400     2400           
=======================================
  Hits         2186     2186           
  Misses        214      214

Copy link
Copy Markdown
Contributor

@kansi kansi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 👍

@kansi kansi merged commit 407b771 into bigchaindb:master Aug 29, 2018
@vrde vrde deleted the fix-validation-error branch August 29, 2018 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants