Page MenuHomePhabricator

[ecash-script] Add new function getStackArray
ClosedPublic

Authored by bytesofman on Jun 17 2023, 17:16.

Details

Reviewers
emack
Group Reviewers
Restricted Project
Commits
rABC265b7aada34d: [ecash-script] Add new function getStackArray
Summary

T3196

Add new function getStackArray to convert a valid eCash OP_RETURN outputScript to an array of data pushes.
`
consumeNextPush` and consume are available for more customized processing (e.g. alias-server uses the returnedWith pushdata from consumeNextData to validate for minimum pushes).

getStackArray is a simple and common use case.

Also validating for max OP_RETURN size since this is a difficult param for devs to find if they are not intimately familiar with the eCash codebase.

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Branch
ecash-script-add-function
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24087
Build 47784: Build Diffecash-script-tests
Build 47783: arc lint + arc unit

Event Timeline

Improved README and code comments

emack requested changes to this revision.Jun 18 2023, 01:44
emack added a subscriber: emack.
emack added inline comments.
modules/ecash-script/test/script.js
367 ↗(On Diff #40851)

Needs another test to validate its handling of the OP_PUSHDATA1 opcode which takes it right to the max bytes limit. e.g. can use the outputscript from this message tx

6a04007461624cd754657374696e672074686520323535206c696d69742054657374696e672074686520323535206c696d69742054657374696e672074686520323535206c696d69742054657374696e672074686520323535206c696d69742054657374696e672074686520323535206c696d69742054657374696e672074686520323535206c696d69742054657374696e672074686520323535206c696d69742054657374696e672074686520323535206c696d69742054657374696e672074686520323535206c696d69742054657374696e672074686520323535206c

This revision now requires changes to proceed.Jun 18 2023, 01:44

Add unit test for OP_RETURN max valid size

This revision is now accepted and ready to land.Jun 19 2023, 23:00