Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default output validator #314

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/ckb/wallet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def generate_tx(target_address, capacity, data = "0x", key: nil, fee: 0, use_dep
# @param data [String] "0x..."
# @param key [CKB::Key | String] Key or private key hex string
# @param fee [Integer] transaction fee, in shannon
def send_capacity(target_address, capacity, data = "0x", key: nil, fee: 0, outputs_validator: "default", from_block_number: 0)
def send_capacity(target_address, capacity, data = "0x", key: nil, fee: 0, outputs_validator: "passthrough", from_block_number: 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe it is safer to set the default value of outputs_validator to 'default'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CKB provides two built-in validators, well_known_scripts_only and passthrough. When no validator is specified, well_known_scripts_only is used.

you means set well_known_scripts_only to be default?
now outputs_validator: "default" will report an error.

tx = generate_tx(target_address, capacity, data, key: key, fee: fee, from_block_number: from_block_number)
send_transaction(tx, outputs_validator)
end
Expand Down Expand Up @@ -359,7 +359,7 @@ def lock
private

# @param transaction [CKB::Transaction]
def send_transaction(transaction, outputs_validator = "default")
def send_transaction(transaction, outputs_validator = "passthrough")
api.send_transaction(transaction, outputs_validator)
end

Expand Down