@@ -27,13 +27,19 @@ type Ouroboros struct {
2727 delayMuxerStart bool
2828 fullDuplex bool
2929 // Mini-protocols
30- Handshake * handshake.Handshake
31- ChainSync * chainsync.ChainSync
32- BlockFetch * blockfetch.BlockFetch
33- KeepAlive * keepalive.KeepAlive
34- LocalTxSubmission * localtxsubmission.LocalTxSubmission
35- LocalStateQuery * localstatequery.LocalStateQuery
36- TxSubmission * txsubmission.TxSubmission
30+ Handshake * handshake.Handshake
31+ ChainSync * chainsync.ChainSync
32+ chainSyncConfig * chainsync.Config
33+ BlockFetch * blockfetch.BlockFetch
34+ blockFetchConfig * blockfetch.Config
35+ KeepAlive * keepalive.KeepAlive
36+ keepAliveConfig * keepalive.Config
37+ LocalTxSubmission * localtxsubmission.LocalTxSubmission
38+ localTxSubmissionConfig * localtxsubmission.Config
39+ LocalStateQuery * localstatequery.LocalStateQuery
40+ localStateQueryConfig * localstatequery.Config
41+ TxSubmission * txsubmission.TxSubmission
42+ txSubmissionConfig * txsubmission.Config
3743}
3844
3945func New (options ... OuroborosOptionFunc ) (* Ouroboros , error ) {
@@ -118,11 +124,16 @@ func (o *Ouroboros) setupConnection() error {
118124 protoOptions .Role = protocol .ProtocolRoleClient
119125 }
120126 // Perform handshake
121- o .Handshake = handshake .New (protoOptions , protoVersions )
127+ handshakeConfig := & handshake.Config {
128+ ProtocolVersions : protoVersions ,
129+ NetworkMagic : o .networkMagic ,
130+ ClientFullDuplex : o .fullDuplex ,
131+ }
132+ o .Handshake = handshake .New (protoOptions , handshakeConfig )
122133 o .Handshake .Start ()
123134 // TODO: figure out better way to signify automatic handshaking and returning the chosen version
124135 if ! o .server {
125- err := o .Handshake .ProposeVersions (protoVersions , o . networkMagic , o . fullDuplex )
136+ err := o .Handshake .ProposeVersions ()
126137 if err != nil {
127138 return err
128139 }
@@ -151,22 +162,22 @@ func (o *Ouroboros) setupConnection() error {
151162 if o .useNodeToNodeProto {
152163 versionNtN := GetProtocolVersionNtN (o .Handshake .Version )
153164 protoOptions .Mode = protocol .ProtocolModeNodeToNode
154- o .ChainSync = chainsync .New (protoOptions )
155- o .BlockFetch = blockfetch .New (protoOptions )
156- o .TxSubmission = txsubmission .New (protoOptions )
165+ o .ChainSync = chainsync .New (protoOptions , o . chainSyncConfig )
166+ o .BlockFetch = blockfetch .New (protoOptions , o . blockFetchConfig )
167+ o .TxSubmission = txsubmission .New (protoOptions , o . txSubmissionConfig )
157168 if versionNtN .EnableKeepAliveProtocol {
158- o .KeepAlive = keepalive .New (protoOptions )
169+ o .KeepAlive = keepalive .New (protoOptions , o . keepAliveConfig )
159170 if o .sendKeepAlives {
160- o .KeepAlive .Start (nil )
171+ o .KeepAlive .Start ()
161172 }
162173 }
163174 } else {
164175 versionNtC := GetProtocolVersionNtC (o .Handshake .Version )
165176 protoOptions .Mode = protocol .ProtocolModeNodeToClient
166- o .ChainSync = chainsync .New (protoOptions )
167- o .LocalTxSubmission = localtxsubmission .New (protoOptions )
177+ o .ChainSync = chainsync .New (protoOptions , o . chainSyncConfig )
178+ o .LocalTxSubmission = localtxsubmission .New (protoOptions , o . localTxSubmissionConfig )
168179 if versionNtC .EnableLocalQueryProtocol {
169- o .LocalStateQuery = localstatequery .New (protoOptions )
180+ o .LocalStateQuery = localstatequery .New (protoOptions , o . localStateQueryConfig )
170181 }
171182 }
172183 // Start muxer
0 commit comments