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

Recursive function #73

Merged
merged 5 commits into from
Mar 25, 2021
Merged

Recursive function #73

merged 5 commits into from
Mar 25, 2021

Conversation

frenchfrog42
Copy link
Contributor

No description provided.

Copy link
Contributor

@xhliu xhliu left a comment

Choose a reason for hiding this comment

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

https://github.com/sCrypt-Inc/boilerplate/tree/recurse

Writing is inconsistent with final_loop_main.scrypt.

library Aux {
static const int fee = 5000;
static const int SizeOfObject = 2;
static function my_great_function(Object object): DoNotTouch {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add an empty line

}

//DO NOT MODIFY
struct DoNotTouch {
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename DoNotTouch -> RecursiveReturn

}
return {{a, b}, recursion_call};
}
static function bytes_to_object(bytes b): Object {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to deserialized

static function bytes_to_object(bytes b): Object {
return {unpack(b[0:1]), unpack(b[1:2])};
}
static function object_to_bytes(Object object): bytes {
Copy link
Contributor

Choose a reason for hiding this comment

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

serialize

}


/*
Copy link
Contributor

Choose a reason for hiding this comment

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

delete dead code below

//Do what you want after
require(true);
}
//Do not touch below
Copy link
Contributor

Choose a reason for hiding this comment

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

Add an empty line

//Return everything util.scriptCode except the space we need in this library
return Util.readVarint(preimage[104:len(preimage)-Aux.SizeOfObject-1]);
}
static function buildOutput(SigHashPreimage preimage, bytes outputScript, int outputSatoshis): bytes {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add empty line before each new function.

Choose a reason for hiding this comment

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

@xhliu would it make sense to automate some of these checks with a linter? Or is there already one in place as part of the build / test process?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea. Will add one.

@xhliu xhliu mentioned this pull request Mar 24, 2021
@xhliu xhliu mentioned this pull request Mar 25, 2021
Copy link
Contributor

@xhliu xhliu left a comment

Choose a reason for hiding this comment

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

💯 well done. This is huge.

@xhliu xhliu merged commit 27ea8ae into sCrypt-Inc:master Mar 25, 2021
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.

None yet

3 participants