Open Rohan-Dah opened 1 year ago
Please don't use the fromOptions method explicitly as that is supposed to be private. Instead use the constructor to pass values while instantiating the object.
Also please add all the field while writing assert.throws() like assert.throws(() => new Coin({ version: '1' }), assert.AssertionError, 'Version must be a uint32.');
The rest seems fine. Please fix the lining issue and please run the main and the linting tests once on your machine.
On it.. Thanks for the response
On Tue, 9 May 2023 at 17:47, Shaswat Gupta @.***> wrote:
The rest seems fine. Please fix the lining issue and please run the main and the linting tests once on your machine.
— Reply to this email directly, view it on GitHub https://github.com/bcoin-org/bcoin/pull/1150#issuecomment-1540023319, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZ7Y5OTAWJP5MQEM3L3NCULXFIYVTANCNFSM6AAAAAAXYFITLY . You are receiving this because you authored the thread.Message ID: @.***>
Line 52: Each assertion here will throw an error if input type is not valid. For example, version must be a number
Line 61: Here we are calculating number of confirmations for a transaction output based on current block height. In the case used here, if the coin height is 100 and current block height is 99, the depth should be 0. If the current block height is 101, the depth should be 2.
Line 77: Here firstly a coin object is created with all the valid attributes such as version, height etc. It then converts the coin object to JSON format using .toJSON() and then creates new coin object by converting JSON back using .fromJSON. This makes sure serialization and deserialization functions are working properly.
Line 95: Here we are creating a new coin object using the input object ‘options’. Here assert statements are checking if coin objects are having correct values for each property.