nervosnetwork / ckb-demo-ruby

CKB Demo Ruby SDK
MIT License
28 stars 16 forks source link

Load Input OutPoint #62

Open u2 opened 5 years ago

u2 commented 5 years ago

https://github.com/nervosnetwork/ckb-demo-ruby-sdk/blob/develop/docs/how-to-write-contracts.md#load-input-outpoint

It's also possible to load input OutPoint from different index:

CKB.load_input_out_point(1, CKB::Source::INPUT)
# This won't trigger errors but would always return nil since output doesn't have
# OutPoint
CKB.load_input_out_point(1, CKB::Source::OUTPUT)

The demo is not consistent with the description. We want to show a different index, but the demo shows a different source.

Another question: what's CKB.load_input_out_point(0, CKB::Source::CURRENT) different from CKB.load_input_out_point(0, CKB::Source::INPUT)

u2 commented 5 years ago

Another question: what's CKB.load_input_out_point(0, CKB::Source::CURRENT) different from CKB.load_input_out_point(0, CKB::Source::INPUT)

I see, for this https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0009-vm-syscalls/0009-vm-syscalls.md#load-input-by-field.

But I think it's better to remove outputs and deps these two kinds of source, they are meaningless, just
lead to confuse, cause only inputs have out_points.