@@ -25,14 +25,13 @@ class SessionTest : public ::testing::Test {
2525 SessionTest ();
2626
2727 // Runs before & after each unit, creates/deletes up session and spy
28- void init ();
28+ void init (Coin::Network );
2929 void cleanup ();
3030
3131// private:
3232 // // NB: None of these routines can return values, as they use QTest macroes which dont return this value.
3333
3434 // Variable shared across all units tests
35- // Coin::Network network;
3635 Session<ID> * session;
3736 SessionSpy<ID> * spy;
3837
@@ -49,7 +48,8 @@ class SessionTest : public ::testing::Test {
4948 const protocol_wire::Ready &,
5049 const Coin::PrivateKey &,
5150 const Coin::PublicKey &,
52- const Coin::PubKeyHash &payeeFinalPkHash);
51+ const Coin::PubKeyHash &payeeFinalPkHash,
52+ Coin::Network network);
5353
5454 // // Routines for doing spesific set of tests which can be used across number of cases
5555 // // Spy is always reset, if affected, by each call
@@ -147,11 +147,15 @@ class SessionTest : public ::testing::Test {
147147 protocol_wire::Ready ready;
148148 paymentchannel::Payee payee;
149149
150- SellerPeer (ID id, protocol_wire::SellerTerms terms, uint32_t sellerTermsIndex)
150+ Coin::Network network;
151+
152+ SellerPeer (ID id, protocol_wire::SellerTerms terms, uint32_t sellerTermsIndex, Coin::Network network)
151153 : id(id)
152154 , terms(terms)
153155 , sellerTermsIndex(sellerTermsIndex)
154- , spy(nullptr ) {
156+ , spy(nullptr )
157+ , network(network)
158+ , payee(network) {
155159 }
156160 protocol_wire::JoiningContract setJoiningContract () {
157161 contractKeys = Coin::KeyPair::generate ();
@@ -166,7 +170,7 @@ class SessionTest : public ::testing::Test {
166170 auto slot = spy->sendReadyCallbackSlot ;
167171 EXPECT_GT ((int )slot.size (), 0 );
168172 ready = std::get<0 >(slot.front ());
169- payee = getPayee ();
173+ payee = getPayee (network );
170174 // Remove message at front
171175 slot.pop_front ();
172176 }
@@ -187,7 +191,7 @@ class SessionTest : public ::testing::Test {
187191 return spy->sendRequestFullPieceCallbackSlot .size () > 0 ;
188192 }
189193
190- paymentchannel::Payee getPayee () {
194+ paymentchannel::Payee getPayee (Coin::Network network ) {
191195 return paymentchannel::Payee (0 ,
192196 Coin::RelativeLockTime::fromTimeUnits (terms.minLock ()),
193197 terms.minPrice (),
@@ -198,13 +202,14 @@ class SessionTest : public ::testing::Test {
198202 joiningContract.finalPkHash (),
199203 ready.contractPk (),
200204 ready.finalPkHash (),
201- Coin::Signature ());
205+ Coin::Signature (),
206+ network);
202207 }
203208 };
204209
205210 typedef std::pair<StartDownloadConnectionInformation, SellerPeer> BuyerSellerRelationship;
206211
207- static Coin::Transaction simpleContract (const std::vector<BuyerSellerRelationship> & v) {
212+ static Coin::Transaction simpleContract (const std::vector<BuyerSellerRelationship> & v, Coin::Network network ) {
208213 paymentchannel::ContractTransactionBuilder::Commitments commitments;
209214 for (auto s : v) {
210215 StartDownloadConnectionInformation inf = s.first ;
@@ -216,7 +221,7 @@ class SessionTest : public ::testing::Test {
216221 paymentchannel::ContractTransactionBuilder builder;
217222 builder.setCommitments (commitments);
218223
219- return builder.transaction ();
224+ return builder.transaction (network );
220225 }
221226
222227 static PeerToStartDownloadInformationMap<ID> downloadInformationMap (const std::vector<BuyerSellerRelationship> & v) noexcept {
0 commit comments