ErrMissingEntry = errors.New("missing entry")
)
-// Output try to get the output entry by given hash
-func (tx *Tx) Output(id Hash) (*Output, error) {
+// IntraChainOutput try to get the intra-chain output entry by given hash
+func (tx *Tx) IntraChainOutput(id Hash) (*IntraChainOutput, error) {
e, ok := tx.Entries[id]
if !ok || e == nil {
return nil, errors.Wrapf(ErrMissingEntry, "id %x", id.Bytes())
}
- o, ok := e.(*Output)
+ o, ok := e.(*IntraChainOutput)
+ if !ok {
+ return nil, errors.Wrapf(ErrEntryType, "entry %x has unexpected type %T", id.Bytes(), e)
+ }
+ return o, nil
+}
+
+// CrossChainOutput try to get the cross-chain output entry by given hash
+func (tx *Tx) CrossChainOutput(id Hash) (*CrossChainOutput, error) {
+ e, ok := tx.Entries[id]
+ if !ok || e == nil {
+ return nil, errors.Wrapf(ErrMissingEntry, "id %x", id.Bytes())
+ }
+ o, ok := e.(*CrossChainOutput)
if !ok {
return nil, errors.Wrapf(ErrEntryType, "entry %x has unexpected type %T", id.Bytes(), e)
}